我的数据框如下所示:
id
444343 [2]
50224018 [7]
4284 [2]
226818 [2, 36]
28484 [29, 15, 52114, 47]
229261 [20]
此数据帧是这行代码的结果:
df= df.groupby('id').station.unique()
这给了我数据帧中每个组的唯一电台。 现在我需要删除所有具有多个站点的行,并将该行转换为常规整数。关于具体例子:
ID station
444343 2
50224018 7
4284 2
229261 20
但我甚至无法访问此列,我尝试添加它的名称df.columns = ["number_from", "station"]
,以使用索引访问它。。没什么
您可以使用
transform
检查nunique
你可以做:
相关问题 更多 >
编程相关推荐