dataframe的表如下
image.png
goterms['namespace'] = ''
image.png
如果需要复制 ,就在索引的位置直接赋值即可
如果要给dataframe的cell赋值为list,注意需要提前转换
#先转换成object类型再插入
>>> df['A']=df['A'].astype('object') # 转换类型
>>> df.info() # 确定类型是否转换成功
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 2 entries, 0 to 1
Data columns (total 2 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 A 2 non-null object
1 B 2 non-null int64
dtypes: int64(1), object(1)
memory usage: 160.0+ bytes
>>> df.at[0,'A']=[1,2,3] # 尝试插入
>>> df # 插入成功
A B
0 [1, 2, 3] 23
1 23 34