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.
Here’s the example CSV file you’ll be using (
Name,Hire Date,Salary,Sick Days remaining Graham Chapman,03/15/14,50000.00,10 John Cleese,06/01/15,65000.00,8 Eric Idle,05/12/14,45000.00,10 Terry Jones,11/01/13,70000.00,3 Terry Gilliam,08/12/14,48000.00,7 Michael Palin,05/23/13,66000.00,8
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.
Gaetano Barreca on Jan. 10, 2020
I tried to installed Pandas without result till I found this:
pip3 install pandas