代码为:
df['号'] = df['编号'].groupby(df['部门']).rank(axis=0, method='first') # 根据部门分组进行编号
报错信息如下:
Exception in Tkinter callback
Traceback (most recent call last):
File "tkinter\__init__.py", line 1883, in __call__
File "分类整理工具.py", line 50, in lab
df['号'] = df['编号'].groupby(df['部门']).rank(axis=0, method='first') # 根据部门分组进行编号
File "pandas\core\groupby\groupby.py", line 2455, in rank
File "pandas\core\groupby\groupby.py", line 996, in _cython_transform
pandas.core.base.DataError: No numeric types to aggregate
其中编号列不是纯数字,不知道有没有影响
求帮助