Category : group-by

This is my table: I am trying to find the purchase more than one product in the first purchase date. And i use the next code: product_quantity = df_tx_spain.groupby([‘CustomerID’,’InvoiceNo’] ,as_index=False).agg({‘InvoiceDate’:’first’,’Quantity’:’first’}) I have the result: CustomerID InvoiceNo InvoiceDate Quantity 0 159 2019061405501106751F 2019-06-14 10:25:00 3 1 159 2019061405501106753F 2019-06-14 14:26:00 1 2 159 2019061505501106761F 2019-06-15 13:19:00 ..

Read more

I have this a dataframe, I show a small part of it in bellow Date Open High Low Close Adj Close Volume stockSymbols Date of Listing Issue Name Sector Market Division 0 2021-04-27 2010.00 2147.00 1891.00 2062.00 2062.00 25489400 5074.T 2021-04-27 TESS Holdings Co.,Ltd. Construction 1st Section 1 2021-04-28 2104.00 2129.00 1933.00 1936.00 1936.00 8973300 ..

Read more

I have the following dataframe: value category 2012-10-02T00:00:00 10 A 2012-10-02T00:00:00 20 B 2012-10-02T00:00:00 25 A 2012-10-02T00:00:00 30 B 2012-10-02T00:00:00 40 C I want to group this data by month summing the values for each unique category. I tried this: grouper=df.reset_index() grouper = grouper.set_index(‘index’).groupby(‘category’).resample(‘M’, how=’sum’) But it creates "DatetimeIndexResamplerGroupby" that i can’t open, how how ..

Read more