汇总一列,并打印出一列而不是全部?

I'm new to python data analysis, sorry if the question is simplistic lol I am summarizing my data using the groupby method to get the total number of parts for each year, I have got the answer but when I print out the table I don't want to include all the other columns as well.The Image shows my output (on the right) vs what I am trying to achieve on the left Thank you in advance

评论
  • Otis
    Otis 回复

    尝试这个:

    sets.groupby('year')['theme_id'].size().reset_index()
    

    希望能帮助到你..