Reputation: 71
I have a dataframe called Dataprep with 19 columns and 18484 raws. I have aggregated the columns I wanted with the code below:
Dataprep.groupby('CustomerKey').OrderQuantity.agg('count')
CustomerKey is the ID number for customers and orderquantity is the number of orders by each customer. The data look like
11000 - 1
11000 - 1
11000 - 1
11000 - 1
11001 - 1
11001 - 1
11001 - 1
11001 - 1
11002 - 1
11002 - 1
11002 - 1
11002 - 1
11002 - 1
11003 - 1
11003 - 1
11003 - 1
11003 - 1
11003 - 1
11004 - 1
11004 - 1
11004 - 1
11004 - 1
First column is customerkey and other one is orderquantity.
My question is how would I apply this to the DataFrame Dataprep. I want to keep all other columns.
Thanks
Upvotes: 1
Views: 37