我有一个熊猫数据帧,它有两列。第一列表示项的name
,第二列表示它的一些属性,这些属性被编码为整数。一个项目可以有多个属性。这是一个样本
name ids
0 A 147 616 813
1 B 51 616 13 813
2 C 776
3 D 51 671 13 813 1092
4 E 13 404 492 903 1093
有300个这样的独特属性被编码为整数,然后在id
列的字符串中表示。我想要达到的目标:
id
13,我将获取1, 3 and 4
行。你知道吗13: [51, 616, 813, 671, 1092, 404, 492, 903, 1093]
52
是否与id13
一起出现过,如果是,在哪里出现过,出现了多少次?你知道吗我想了这么久,但没有一个有效的方法来获得前两个和一个有效的方法以及DS的3)。请帮帮我!你知道吗
以下是三项职能的建议:
然后你可以测试他们:
不使用任何for循环的解决方案
相关问题 更多 >
编程相关推荐