Category : Pandas

rename columns name: df = df.rename(columns={“oldcol1″:”newcol1″,”oldcol2”: “newcol2”}) change value of a column under a condition: df_confirmed.loc[df_confirmed[‘country’] == “US”, “country”] = “USA” replace NaN with some value: df_confirmed = df_confirmed.replace(np.nan, ”, regex=True) drop several columns(Lat and Long): df = df.drop([‘Lat’,’Long’..

Read more