【发布时间】:2018-07-25 04:17:15
【问题描述】:
我有两个列表,我想找到它们的交集。
b = set(a)& set(list_a)
b
{'118184', '907', '95828', '95957', '95977', '95983', '95984', '95985'}
现在我希望 b 成为一个列表(而不是集合),所以我尝试
b.apply(list)
(How can I convert set to list in pandas?)
我收到以下错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-273-cfd36ffc3bfc> in <module>()
----> 1 b.apply(list)
AttributeError: 'set' object has no attribute 'apply'
谢谢!
【问题讨论】:
-
b = list(b)? -
也试过了:TypeError: 'list' object is not callable
-
重启 IDE ;) 因为它似乎覆盖了
list