[英]How to append a pandas Dataframe with a list?
I have a list which I get after performing x=list(df.iloc[3])
the list which I get is 我有一个列表,我在执行
x=list(df.iloc[3])
得到的列表是我得到的
[u'some name',
u'some product name',
u'some url',
u'Development',
u'Web Development',
u'MX2,250',
14247,
4160,
nan]
I have to append this list into another dataframe named "new" with columns 我必须将此列表附加到另一个名为“new”的数据框中
Index(
[u'Instructor Name', u'Product Name',
u'Product Url', u'Category 1', u'Category 2',
u'Price', u'Students Enrolled', u'Reviews', u'Stars'],
dtype='object')
When I use new.append(x,ignore_index=True)
I am getting a new column with the values of x in it which is not what I want. 当我使用
new.append(x,ignore_index=True)
我得到一个新的列,其中x的值不是我想要的。 How to flatten the list so values of x can be appended with the new. 如何展平列表,以便x的值可以附加新的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.