I have a pandas df with three columns, purchase_day, customer_name, products_purchased.
I want to return an array of number of days that each customer visited the store. So I used
gpd = df.groupby(by=['customer_name', 'purchase_day']).count()
which returns a table that looks like:
Unfortunately with this returned table, I can't run groupby on it because of the unusual format (where customer_name and purchase_days aren't in the first row but in the second).
Any tips so that I can count the number of purchase_days each customer visited the store?