0

I've been using stack for some time, but it's my first time asking a question so be understanding. Table here

I've got a dataframe where one column are author names, second column is citation number, and the last one is the topic. Pic attached. Each row is a different entry. For each author, I want to find an average number of citations, the topics they've written on, and sort it according to the citation number. I've tried doing these things separately (one dataframe groups the topics, one finds the mean), but I can't figure out how to do it when all values are in one dataframe.

For instance: Bob, 6, Topic 1 Bob, 8, Topic 2, Anna, 1, Topic 1,

I want it to look like: Bob, 7, Topic 1, Topic 2 Anna, 1, Topic 1

  • Welcome @Porky_Pig, please provide your example data as **text**, an image is not useful to reproduce your question – mozway Feb 09 '23 at 15:41
  • You most likely want `df.groupby(['Authors', 'Research Topic'], as_index=False).mean()` – mozway Feb 09 '23 at 15:43

0 Answers0