pandas.errors.UnsupportedFunctionCall#

exception pandas.errors.UnsupportedFunctionCall[源代码][源代码]#

尝试调用不支持的 numpy 函数时引发的异常。

例如, np.cumsum(groupby_object)

示例

>>> df = pd.DataFrame(
...     {"A": [0, 0, 1, 1], "B": ["x", "x", "z", "y"], "C": [1, 2, 3, 4]}
... )
>>> np.cumsum(df.groupby(["A"]))
Traceback (most recent call last):
UnsupportedFunctionCall: numpy operations are not valid with groupby.
Use .groupby(...).cumsum() instead