I have a dataframe like
import pandas as pd
data = {"Column1" : ["Income recorded on books this year not included on Schedule K, lines 1 through 11 (itemize):",
"a Tax-exempt interest $ Statement #36",
"Statement #36"],
"Column2" : [254, 258, 356]}
df = pd.DataFrame(data)
print(df)
Column1 Column2
0 Income recorded on books this year not included on Schedule K, lines 1 through 11 (itemize): 254
1 a Tax-exempt interest $ Statement #36 258
2 Statement #36 356
I want to replace the string $ Statement #36 in the second row
Tried with the
df['Key'] = df['Column1'].str.replace(r'\b$ Statement #36\b', '')
But I'm not able to replace the string in the column
Desired Output
Column1 Column2
0 Income recorded on books this year not included on Schedule K, lines 1 through 11 (itemize): 254
1 a Tax-exempt interest 258
2 Statement #36 356