import pandas as pd
#define DataFrame
df = pd.DataFrame({'team':['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B'],
'points': [25, 12, 15, 14, 19, 23, 25, 29],
'assists': [5, 7, 7, 9, 12, 9, 9, 4],
'rebounds': [11, 8, 10, 6, 6, 5, 9, 12]})
#list column names
list(df)
['team', 'points', 'assists', 'rebounds']
#rename specific column names
df.rename(columns = {'team':'team_name', 'points':'points_scored'}, inplace = True)
#view updated list of column names
list(df)
['team_name', 'points_scored', 'assists', 'rebounds']
Discover the world of data with our Data Science Course and embark on a transformative journey towards analytical excellence.