我有一份清单:
[['1', 'Toy Story (1995)', "Animation|Children's|Comedy"],
['2', 'Jumanji (1995)', "Adventure|Children's|Fantasy"],
['3', 'Grumpier Old Men (1995)', 'Comedy|Romance']]
我想用这些列来结束pandas数据帧。在
^{pr2}$对于'Adventure', 'Children', 'Comedy', 'Fantasy', 'Romance'
列,数据将为1或0。在
我试过:
for row in movies_list:
for element in row:
if '|' in element:
element = element.split('|')
但是原始列表没有任何变化。。完全被困在这里。在
将} 一起使用:
DataFrame
构造函数与^{对于列} 和{a3}来删除尾随}被转换为
^{pr2}$Name
和Year
需要^{)
,并且{int
s最后一次删除列} :
Data
,并将df1
添加到原始列^{这是我的版本,不足以回答一句话,但希望它能帮助你!在
输出:
^{pr2}$相关问题 更多 >
编程相关推荐