#group by team and position and find mean assists
new = df.groupby(['team', 'position']).agg({'assists': ['mean']}).reset_index()
#rename columns
new.columns = ['team', 'pos', 'mean_assists']
#view DataFrame
print(new)
team pos mean_assists
0 A G 5.0
1 B F 6.0
2 B G 7.5
3 M C 7.5
4 M F 7.0
Hi, I'm having issues with accessing the first two columns.
I thought
for i in range(5):
print(new["team"][i])
would be possible