Reputation: 1
data=df.groupby('Term')['Subject'].apply(tuple)
I wrote this line in python but I didn't achieved desired output. Can anyone help me out.
I tried many grouping methods but I never came up with the output.
Upvotes: 0
Views: 59
Reputation: 376
If you are looking at the average of the Subject
column grouped by Term
, you were actually quite close:
df.groupby('Term')['Subject'].mean()
Upvotes: 1