Im trying to:
count_values to count the occurrences of the same value under invoice_line_normal_price and groupby shop_name
This here is my df:
I'm trying to end up with:
So far i know I can use:
df.value_counts('invoice_line_normal_price').to_frame('counts')
to get the counts without the grouping, but how would I add the grouping here?
Any help would be greatly appreciated, thanks.
Traceback (most recent call last): Python/CouponRedemptions/start.py", line 22, in
print(v['invoice_line_normal_price'])
File "/home/ben/.local/lib/python3.8/site-packages/pandas/core/frame.py", line 2902, in __getitem__
indexer = self.columns.get_loc(key)
File "~/.local/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 2893, in get_loc
raise KeyError(key) from err
KeyError: 'invoice_line_normal_price'
– BenniBenassi Apr 22 '21 at 10:14