create a colun in pandas using groupby

Solutions on MaxInterview for create a colun in pandas using groupby by the best coders in the world

showing results for - "create a colun in pandas using groupby"
Lya
04 Jan 2017
1In [13]: df.groupby(["item", "color"])["id"].transform("count")
2Out[13]:
30    2
41    2
52    2
63    1
74    2
8dtype: int64
9