Horje
rename one dataframe column python in inplace Code Example
rename one dataframe column python in inplace

import pandas as pd

d1 = {'Name': ['Pankaj', 'Lisa', 'David'], 'ID': [1, 2, 3], 'Role': ['CEO', 'Editor', 'Author']}

df = pd.DataFrame(d1)

print('Source DataFrame:\n', df)

df.rename(index={0: '#0', 1: '#1', 2: '#2'}, columns={'Name': 'EmpName', 'ID': 'EmpID', 'Role': 'EmpRole'}, inplace=True)

print('Source DataFrame:\n', df)




Python

Related
how to print data type in python Code Example how to print data type in python Code Example
python for data analysis Code Example python for data analysis Code Example
sqlalchemy function for default value for column Code Example sqlalchemy function for default value for column Code Example
first and last name generator python Code Example first and last name generator python Code Example
getting multiple of 5 python Code Example getting multiple of 5 python Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
6