Answers for "python pandas rename values in column"

0

rename one dataframe column python

#suppy as dict the column name to replace
df1 = df.rename(columns={'Name': 'EmpName'})
print(df1)
Posted by: Guest on May-30-2021
0

pandas description of dataframe renaming column values

dict = {
    'Android': 'Android',
    'Chrome OS': 'Chrome OS',
    'Linux': 'Linux',
    'Mac OS': 'macOS',
    'No OS': 'No OS',
    'Windows': 'Windows',
    'macOS': 'macOS'
}

df['col'] = df['col'].map(dict)
Posted by: Guest on July-27-2021

Python Answers by Framework

Browse Popular Code Answers by Language