Question #5857
Submitted by Answiki
on 02/04/2022 at 11:54:48 AM UTC
In Python / Pandas, how to specify the file has no header with read_csv()?
Answer
Submitted by Answiki
on 02/04/2022 at 12:11:51 PM UTC
In Python / Pandas, one of the optional parameters of read_csv() is header. This parameter tells the interpreter, how many rows to use as the column names. Setting this parameter to None tells the interpreter that the file has no header:
import pandas as pd
# Load csv file without header
data = pd.read_csv("filename.csv", header=None)
Answer by Answiki on 02/04/2022 at 12:11:51 PM
In Python / Pandas, one of the optional parameters of read_csv() is header. This parameter tells the interpreter, how many rows to use as the column names. Setting this parameter to None tells the interpreter that the file has no header:
import pandas as pd
# Load csv file without header
data = pd.read_csv("filename.csv", header=None)
Question by Answiki 02/04/2022 at 11:54:48 AM
In Python / Pandas, how to specify the file has no header with read_csv()?
| # | ID | Query | URL | Count |
|---|---|---|---|---|
| 0 | 13691 | alphons | https://en.ans.wiki/5857/in-python-pandas-how-to-specify-the-file-has-no-header-with-read_csv | 1 |
| 1 | 12533 | en | https://en.ans.wiki/5857/in-python-pandas-how-to-specify-the-file-has-no-header-with-read_csv | 7 |
Icons proudly provided by Friconix.