Pandas Groupby Query Help

c=d.groupby(‘cut’)[‘cut’].count()?

what does this do here???

I know something is counted.

(‘cut’)[‘cut’] what this does??

Hi,

The above snippet is used to group the dataframe using the column named ‘cut’.
Note that, it will group our dataframe using cut column, but return the whole dataframe (all columns)

The above snippet is used to consider only cut column of that grouped dataframe which was returned to us.

I hope this helps, let me know if i may need to explain it better.

Thanks a lot bro.Really aprreciate it

1 Like