python pandas如何在没有未命名列的情况下读取excel文件

时间:2018-03-21 20:04:58

标签: pandas tableau xlsx

我想使用python pandas读取.xlsx。问题是在excel文件的开头,它有一些额外的数据,如表的标题或描述,表内容开始。这引入了未命名的列,因为pandas DataReader将其作为列。 但表格内容在几行之后开始。

A                              B                     C
this is description
last updated: Mar 18th,2014
                               Table content
Country                        Year                 Product_output
Canada                         2017                 3002
Bulgaria                       2016                 2201
...

表格内容从第4行开始。列必须是“Country”,“year”,“proudct_output”而不是“this is description”,“unnamed”,“unnamed”。

1 个答案:

答案 0 :(得分:1)

当您使用read_excel函数集skiprows参数为3时。