The Next Level of Pandas read_csv( )

Gustavo Santos
gustavorsantos
Published in
5 min readJun 4, 2021

--

9 underused parameters of the well know Pandas’ read_csv() method.

Photo by billow926 on Unsplash

We all know Pandas’ (probably) most used method pd.read_csv() .

But do you know it has a lot (and I mean it!) of cool features for you to start transforming your data during the loading?

In this article, I will share 9 of those tricks, so you can add them to your Data Scientist toolbox and achieve the next level of exploratory data analysis.

Install and Load Pandas

Like any regular library in Python, you can install using pip and then import the pack to the session.

pip install pandas
import pandas as pd

1. Change the separator / delimiter

The method is read_csv() , but you can actually pull tab separated (tsv) or a file separated by any other delimiter. Just use the parameter delimiter='xx' .

# Loading with sep or delimiter parameter for a file separated by --
df = pd.read_csv('/content/sample--.csv', delimiter='--',
engine='python')
Without and with delimiter parameter. Image by the author.

2. Setup a different…

--

--

Gustavo Santos
gustavorsantos

Data Scientist. I extract insights from data to help people and companies to make better and data driven decisions. | In: https://www.linkedin.com/in/gurezende/