Reputation: 544
Code:
import pandas as pd
df = pd.read_csv('Overbuff_scraped_22-04-2019.csv',encoding='latin')
df.to_csv('Overbuff_scraped_22-04-2019.csv',encoding='utf-8')
df2 = df.drop(['Unnamed: 0'],axis=1)
df2.rename(columns={'Pick_rate':'PickRate','Win_rate':'WinRate','Tie_Rate':'TieRate','On_fire':'OnFire'},inplace=True)
df2.head()
I would like to change the name of df2['Hero']=='Lúcio' to 'Lucio'. I do not know how to do this.
I have tried:
df2.rename(df2['Hero']=='Lúcio', 'Lucio')
Upvotes: 0
Views: 145
Reputation: 323236
That is not the name , it is value , so we do
df2.loc[df2['Hero']=='Lúcio','Hero'] = 'Lucio'
Upvotes: 1