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) 




2 events in history
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

Icons proudly provided by Friconix.