Reputation: 1205
I have a dataframe like the below and I am trying to print the list of subjects for each unique ID.
ID Name Subjects
0 Tom [maths,chem,history....]
1 Harry [biology,physics,maths...]
And then iterate over the length of the subject list to do different operations.
for Subjects in ID:
print(Subjects)
for idx in range(len(Subjects)):
-- Do operations ---
I did this:
for df.Subjects in df.ID:
print(df.Subjects)
But this printed ID Numbers.
Upvotes: 0
Views: 44