我正在尝试将列表列表转换为pandas数据帧。这是清单:
[[array([[u'2017-08-22', u'xxx BRAZIL', u'channel_name1',
u'SEM xx-xx', u'sessions', u'-0.413447782546', u'-1156',
u'1640.0', u'2796.0']],
dtype='<U32')], [array([[u'2017-08-22', u'xxx BRAZIL', u'channel_name1',
u'xx-xx', u'sessions', u'0.0180327868852', u'11',
u'621.0', u'610.0']],
dtype='<U32')], [array([[u'2017-08-22', u'xxx BRAZIL', u'channel_name1',
u'xx-xxx', u'sessions', u'-0.0529421060949',
u'-1005', u'17978.0', u'18983.0']],
dtype='<U32')], [array([[u'2017-08-22', u'xxx BRAZIL', u'channel_name1',
u'xx-xx', u'sessions', u'-0.150395778364', u'-114',
u'644.0', u'758.0']],
...
这是我的代码:
df = DataFrame(outliers_list)
但我得到的是输出:
0
0 [[2017-08-22, XXX, channel_name1, RE...
1 [[2017-08-22, xxx, channel_name1, CR...
2 [[2017-08-22, xxx, channel_name1, DI...
3 [[2017-08-22, xxx, channel_name1, AF...
4 [[2017-08-22, xxx, channel_name1, RE...
5 [[2017-08-22, xxx, channel_name1, CR...
6 [[2017-08-22, xxx, channel_name1, DI...
7 [[2017-08-22, xxx, channel_name1, RE...
8 [[2017-08-22, xxx, channel_name1, CR...
9 [[2017-08-22, xxx, channel_name1, DI...
我将整行排成一列。如何分隔列?
答案 0 :(得分:2)
尝试这样的事情:
df = pd.DataFrame([a[0][0] for a in outliers_list])