0

I'm new to programming overall, and I'm struggling with some pandas df aggregation.

I'm trying to group a df by two columns "A" and "B" and then the series to display the frequency of B, over all the data, not only the group. I'm trying the below. group = df.groupby(['A', 'B']).size() ###this will show only the group frequency of B.

Let's say A is a transaction Id and B is a product. I want to know how many times each product appears when looking over all transactions, but in this structure of grouping, and keeping it into a grouped series not changing back to a df.

Thank you

Andru
  • 1
  • 1
    Hi. Welcome to StackOverflow. Please update your post to include a [minimum reproducible example](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) and your expected output. – not_speshal Apr 26 '22 at 15:02

0 Answers0