Afternoon All,
I have a very large dataset which I have groupedby. Here is a sample :
df_ccy = df.groupby(['currency_str','state'
['state'].count().reset_index(name='count').sort_values(['count'], ascending=False)
display(df_ccy)
Output:
currency_str state count
USD Traded Away 148
AUD Dealer Timeout 52
CAD Done 44
USD Covered 38
USD Dealer Timeout 29
ZAR Done 22
I would like to only show:
CAD Done 44
ZAR Done 22
I achieved this via:
display(df_ccy [df_ccy ['state']=='Done'][['currency_str','state','count']])
Should I use a Lambda function on the original groupby statement or filter as I have done above? What is best practice?