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 w
You can mimic the behavior of rstrip using replace with regex=True, which can be applied to the entire DataFrame:
rstrip
replace
regex=True
DataFrame
df.replace(r'f$', '', regex=True)
A B 0 123 789 1 456 901
Since rstrip takes a sequence of characters to strip, you can easily extend this:
df.replace(r'[abc]+$', '', regex=True)