简体   繁体   English

如何将带有多个标题行的csv文件读入pandas?

[英]How to read a csv file with multiple header rows into pandas?

I am not sure how to read the multiple rows. 我不知道如何阅读多行。 Do i have to do it without the rows and then do it manually in pandas? 我必须在没有行的情况下这样做,然后在熊猫中手动完成吗? Or is there a way to read the whole csv file into pandas? 或者有没有办法将整个csv文件读入熊猫?

This is how the file looks Poverty data 这是文件看起来贫穷数据的方式

read_csv需要参数header=[0,1]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在标头的行中使用带有更多分隔符的Pandas读取csv文件? - How to read a csv file with Pandas with more delimiters in the rows that in the header? 如何将 csv 文件读入熊猫,跳过行直到某个字符串,然后选择第一行作为标题和分隔符作为 | - How to read csv file into pandas, skipping rows until a certain string, then selecting first row after as header and delimiter as | How to read every column of a csv file in python after every 10-15 rows which have the same header using pandas or csv? - How to read every column of a csv file in python after every 10-15 rows which have the same header using pandas or csv? 如何将多个csv文件读入熊猫并在一个csv文件中输出 - How to read multiple csv files into pandas and output in one csv file 熊猫:如何从CSV文件读取特定行 - Pandas: How to read specific rows from a CSV file 如何使用python中的pandas读取csv文件的所有行? - How to read all rows of a csv file using pandas in python? 熊猫:如何从CSV或Excel文件中读取行? - Pandas: How to read rows from CSV or Excel file? Pandas read_csv():保持 header 然后在从文件中读取时跳过行? - Pandas read_csv(): keeping the header and then skip rows when reading in from file? 如何将多个无序行与大熊猫合并为单个行[CSV文件] - How to combine multiple unordered rows into a single row with pandas [CSV file] 读取多行包含 header 的 CSV 文件 - Reading CSV file with multiple rows containing header
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM