索引不正确的数据帧

时间:2017-04-11 10:38:10

标签: python dataframe

当我将Python中存在的文件转到table = [' Mary Poppins Went to school', ' In the morning of April 2010', ' When it Suddenly, rained 10' ] .set_index(table) or pd.DataFrame(table, columns = ['text']). 时,它将其作为第一列而不是列名。我希望这是带有标题的第二列,但在使用例如

时它不起作用
                                     text
Mary Poppins Went to school          ...
In the morning of April 2010         ...
When it Suddenly, rained 10          ...

pd.DataFrame:

Apple         N/A
Apricot       N/A
Avocado       N/A
Banana        N/A
Breadfruit    N/A
Apple         Apple
Blackberry    N/A
Blackcurrant  N/A
Blueberry     N/A
Boysenberry   N/A
Currant       N/A
Cherry        N/A
Cherimoya     N/A
Blueberry     Blueberry
Cloudberry    N/A
Coconut       N/A

如何轻松解决此问题,以便文本位于文本列中?

0 个答案:

没有答案