Skip to content

Instantly share code, notes, and snippets.

@johardi
Created December 19, 2016 06:55
Show Gist options
  • Save johardi/707aab3df387cb9ef42647bff757e0b2 to your computer and use it in GitHub Desktop.
Save johardi/707aab3df387cb9ef42647bff757e0b2 to your computer and use it in GitHub Desktop.
Create dictionary from CSV
import os
import csv
import numpy as np
data = {}
with open(os.path.expanduser('~/Downloads/people_wiki.csv')) as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
for column, value in row.items():
data.setdefault(column, []).append(value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment