我有一个熊猫数据帧是这样的:Pandas DF有一个列表。如何重复此列表的每个值的行?
title author year type
0 t1 a1 1980 article
1 t2 ['a2', 'a3', 'a4'] 1983 article
2 t3 a5 1982 article
3 t4 a6 1977 article
4 t5 ['a7','a8'] 2011 book
这是一个简短的例子,原来是更加大。
我需要这样一个数据帧:
title author year type
0 t1 a1 1980 article
1 t2 a2 1983 article
2 t2 a3 1983 article
3 t2 a4 1983 article
4 t3 a5 1982 article
5 t4 a6 1977 article
6 t5 a7 2011 book
7 t5 a8 2011 book
注意,名单有不同数量的元素
的可能的复制http://stackoverflow.com/questions/27263805/pandas- when-cell-contents-are-lists-create-a-row-for-each-element-in-the-list – bigbounty