Categories
Python Answers

How to read in table without headers with Python Pandas?

Spread the love

Sometimes, we want to read in table without headers with Python Pandas.

In this article, we’ll look at how to read in table without headers with Python Pandas.

How to read in table without headers with Python Pandas?

To read in table without headers with Python Pandas, we call read_csv with the header argument set to None.

For instance, we write

df = pd.read_csv(file_path, header=None, usecols=[3, 6])

to call read_csv with the file_path to the csv file.

header is set to None to skip the headers.

And we set usecols to [3, 6] to get the 4th and 7th columns.

Conclusion

To read in table without headers with Python Pandas, we call read_csv with the header argument set to None.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *