I have a dataframe with multiple string columns. I want to use a string method that is valid for a series on multiple columns of the dataframe. Something like this is what I would wish for:
df = pd.DataFrame({'A': ['123f', '456f'], 'B': ['789f', '901f']})
df
Out[15]:
A B
0 123f 789f
1 456f 901f
df = df.str.rstrip('f')
df
Out[16]:
A B
0 123 789
1 456 901
Obviously, this doesn't work because str operations are only valid on pandas Series objects. What is the appropriate/most pandas-y method to do this?