import pandas as pd
c=pd.DataFrame({'a':[1,2,3,1,2,1,1,1,1]})
c.groupby('a').count()
--------
理论上应该有这个结果:
a amount
1 6
2 2
3 1
----------
然鹅,是这个:
Empty DataFrame
Columns: []
Index: [1, 2, 3]
-------------------
为什么呢?
如果要形成想要的结果,应该怎么写呀,我想不明白哪儿错了
c=pd.DataFrame({'a':[1,2,3,1,2,1,1,1,1]})
c.groupby('a').count()
--------
理论上应该有这个结果:
a amount
1 6
2 2
3 1
----------
然鹅,是这个:
Empty DataFrame
Columns: []
Index: [1, 2, 3]
-------------------
为什么呢?
如果要形成想要的结果,应该怎么写呀,我想不明白哪儿错了