我正在使用以下内容对pandas数据框执行我认为的简单groupby语句:
count = x.groupby(
pd.Grouper(key='created_at', freq='M'))['support_type'].value_counts()
但是,这会引发以下错误:
回溯(最近一次呼叫最后一次):文件" cat_test.py",第62行, pd.Grouper(key =' created_at',freq =' M'))[' support_type']。value_counts()文件 " /usr/local/lib/python3.4/dist-packages/pandas/core/groupby.py" ;, line 3171,在value_counts中 labels = list(map(rep,self.grouper.recons_labels))+ [llab(lab,inc)]文件 " /usr/local/lib/python3.4/dist-packages/pandas/core/groupby.py" ;, line 3141,in llab = lambda lab,inc:lab [inc]
IndexError:布尔索引与维度0的索引数组不匹配;维度是0但是 相应的布尔维数为1