Let's use the following sequence of steps to import the data and start our exploration of this dataset in Python:
- With the following snippet, we will create a Python list in memory that contains dictionaries of each row, where the keys are the column names (the first row of the CSV contains the header information) and the values are the values for that particular row:
In [3]: import csv ...: data_file = "../data/income_dist.csv" ...: with open(data_file, 'r') as csvfile: ...: reader = csv.DictReader(csvfile) ...: data = list(reader)
- We perform a quick check with len to reveal the number of records: ...