Read CSV Data Into a Pandas DataFrame

Your goal

Your data is in a local CSV file, and you want to read it into a Pandas DataFrame.

Step-by-step tutorial

Use the Pandas read_csv() function for this:

>>> import pandas as pd
>>> customer_df = pd.read_csv('data/customers.csv')
>>> customer_df
      id  last_name   first_name           city state    zip       phone
0  20193      Smith         John        Seattle    WA  98101  4255551234
1  20194      Smith         Mary        Seattle    WA  98101  4255551235
2  20203     Martin  Christopher  Moreno Valley    CA  92553  9515551234
3  20205    Blevins       Tarana     Pittsburgh    PA  15201  4125551234
4  20210  Velasquez       HernĂ¡n  Moreno Valley    CA  92557  9515551122
5  20211  Velasquez       Gisela  Moreno Valley    CA  92557  9515551122
6  20228      Patel       Ramesh      Sammamish    WA  98074  4255551122

If your data is tab-delimited, you can use the delimiter parameter:

customer_df = pd.read_csv('data/customers.tsv', delimiter='\t')