Python 熊猫:将列表中的值添加到数据帧中
假设我有一个数据帧,看起来像这样:Python 熊猫:将列表中的值添加到数据帧中,python,python-3.x,pandas,Python,Python 3.x,Pandas,假设我有一个数据帧,看起来像这样: df2 A 0 stuff = ['apples', 'oranges'] A 0 ['apples', 'oranges'] 我有一个如下列表: df2 A 0 stuff = ['apples', 'oranges'] A 0 ['apples', 'oranges']
df2
A
0
stuff = ['apples', 'oranges']
A
0 ['apples', 'oranges']
我有一个如下列表:
df2
A
0
stuff = ['apples', 'oranges']
A
0 ['apples', 'oranges']
我想将列表中的记录添加到数据框中,以便我的输出如下所示:
df2
A
0
stuff = ['apples', 'oranges']
A
0 ['apples', 'oranges']
有什么建议吗?我不知道从哪里开始。使用。网址:
您可以执行以下操作
import pandas as pd
list = [['oranges', 'apples']]
df= pd.DataFrame()
df['A'] = list
要访问单元格,请使用df.atdf['A']=list将定义'A'列