我想使用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”。
答案 0 :(得分:1)
当您使用read_excel
函数集skiprows
参数为3时。