将清单清单插入pandas df单栏 [英] Insert list of lists into single column of pandas df

查看:62
本文介绍了将清单清单插入pandas df单栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将多个列表放入Pandas df的单个列中.我的列表列表很长,因此无法手动执行.

I am trying to place multiple lists into a single column of a Pandas df. My list of lists is very long, so I cannot do so manually.

所需的输出看起来像这样:

The desired out put would look like this:

list_of_lists = [[1,2,3],[3,4,5],[5,6,7],...]
df = pd.DataFrame(list_of_lists)
>>> df
    0
0   [1,2,3]
1   [3,4,5]
2   [5,6,7]
3   ...

谢谢您的协助.

推荐答案

df = pd.DataFrame({0: [[1,2,3],[3,4,5],[5,6,7]]})

这篇关于将清单清单插入pandas df单栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆