Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Reading CSVs With Pandas

This lesson covers a couple different ways to import CSV data into the third party Pandas library. In this video, you’ll learn how to install pandas using pip and, how to use it to read CSV files.

The following example shows how to read a CSV file and print out its contents using pandas:

import pandas as pd

data_frame = pd.read_csv('hrdata.csv')
print(data_frame)

In addition to learning how to read CSV files and printing their contents, you will see how to use pandas to modify the index on the files you read, parse dates and also how to add headers to CSV files without one.

Comments & Discussion

Become a Member to join the conversation.