Reputation: 323
So I tried to rename columns so that it looks cleaner when it outputs in Jupyter notebook:
df = df.rename(columns={'i_Team':'I Team', 'Full_Name':'Full Name'}, inplace = True)
But I get the following error:
AttributeError: 'Styler' object has no attribute 'rename'
Any idea what could be causing the issue? Thanks in advance!
Upvotes: 1
Views: 3279
Reputation: 757
Your df
is not a dataframe object but a Styler
object. First convert it into the dataframe object using:
final_df = df.data
then apply,
final_df.rename(columns={'i_Team':'I Team', 'Full_Name':'Full Name'}, inplace = True)
Also, please note that you need not re-assign to original variable when using inplace=True
Upvotes: 1