Created
August 3, 2017 23:54
-
-
Save MNovak12/4939fd93431b287b0b163587a433ab09 to your computer and use it in GitHub Desktop.
Create a dictionary from a csv file where the header row is the keys, and the values are the data in a list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
data = pd.read_csv('test.csv') | |
all_rows = {} | |
for row in data: | |
items = [] | |
for x in data[row]: | |
if not pd.isnull(x): | |
items.append(x) | |
all_rows[row] = items | |
print all_rows |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment