新手 - 我的第一次尝试似乎没问题,但这是我第二次使用熊猫。在 Windows 7 上使用 Pandas 0.12.0 时,我从 SQL One 中读取了 2 个数据帧,按预期与 groupby 一起工作,所以我确定我的问题不是语法。但另一方面,type(reddf)返回pandas.core.frame.DataFrame,当尝试reddf.groupby('any column')时,我得到 - 最后几行 -
c:\python27\lib\site-packages\pandas\core\groupby.pyc in __init__(self, index, grouper, name, level, sort)
1197 # no level passed
1198 if not isinstance(self.grouper, np.ndarray):
-> 1199 self.grouper = self.index.map(self.grouper)
1200 if not (hasattr(self.grouper,"__len__") and \
1201 len(self.grouper) == len(self.index)):
c:\python27\lib\site-packages\pandas\algos.pyd in pandas.algos.arrmap_int64 (pandas\algos.c:62839)()
Run Code Online (Sandbox Code Playgroud)
TypeError: 'DataFrame' object is not callable
我知道groupby 没问题,并且该列存在,因此数据帧上还有一些其他约束/条件,我只是不知道或忽略了。那么什么会导致这个错误呢?我该怎么办?我将来应该寻找什么?
请求的信息
print type(reddf.index)
<class 'pandas.core.index.Int64Index'>
print repr(reddf.index)
Int64Index([0, 1, 2, 3, 4, 5, …Run Code Online (Sandbox Code Playgroud)