pandas.DataFrame构造函数中的列表列表 - 边缘情况?

时间:2014-06-26 20:12:48

标签: pandas

这是我遇到麻烦的地方:

import pandas as pd
df = pd.DataFrame( index = [1,3,5,7,11] )
df['lists'] = [ ['a'],['b'],['c'],['a',b'],['a','b','c'] ]
df['listOflists'] = [ [['a']], [['b'],['a']], [['c']], [['d']], [['e']] ]
df['listOfLists1'] = [ [['a']], [['b']], [['a','c']], [['a','b','d']], [['e']] ]
print df
df['listOfLists_fails'] = [ [['a']], [['b']], [['a']], [['d']], [['e']] ]

最后一个示例(仅)在0.11.0中引发错误。我可以通过分配元素来解决这个问题,但这看起来很难看。有谁知道幕后发生了什么?

0 个答案:

没有答案