I should have used rename
with re.sub
:
import re
raw_data = raw_data.rename(columns=lambda x: re.sub(' $','',x))
Or to change in-place:
raw_data.rename(columns=lambda x: re.sub(' $','',x), inplace=True)
I should have used rename
with re.sub
:
import re
raw_data = raw_data.rename(columns=lambda x: re.sub(' $','',x))
Or to change in-place:
raw_data.rename(columns=lambda x: re.sub(' $','',x), inplace=True)