I'm a begginer in the subject and didn't find anything to help me here so far. I'm struggling in grouping my data and then filtering with a value I need.
Like the example,
I need to Know, for example, how many Red Cars Juan bought. (Red Cars sells for each client). When I try, I loose the group or the filter, I can't do both.
Can someone help me or suggest a post please?
Edit1.
With the help of the community, I find this as my solution:
df = df.loc[:, df.columns.intersection(['Name', 'Car colour', 'Amount'])]
df = df.query('Car colour == Red')
df.groupby(['Name', 'Car colour'])['Amount'].sum().reset_index()