I've used the os module to pull file names and created a DataFrame from the titles like this:
Invoice Vendor Amount
0 2131 FileName1 68.00.pdf
1 2132 FileName2 68.00.pdf
How can I delete the .pdf from the amounts so I can find the sum of that column?
CodePudding user response:
df['Amount'] = df['Amount'].str.rstrip('.pdf')
CodePudding user response:
df['Amount']=df['Amount'].str.replace('.pdf','',regex=True)
df
Invoice Vendor Amount
0 2131 FileName1 68.00
1 2132 FileName2 68.00