Lambda函数中不可调用TypeError“int”对象

2024-06-29 01:08:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图找到重复的,并将它们分组在“技术人员”表中

display(technician['Tech_id'].value_counts().sort_values(ascending=False).head())
duplicate_technicians = technician.groupby('Tech_id').filter(lambda x: len(x) == 2)

这一行抛出一个错误

TypeError: 'int' object is not callable

错误尤其在lambda函数中

duplicate_technicians.filter(lambda x: len(x) == 2)

这是“技术人员”表供参考

enter image description here

我是新来的。有人能帮我吗


Tags: lambdaidlenvalue错误displayfiltersort