Created
January 17, 2017 23:41
-
-
Save mdiener21/1f08b04bc5f87248b361c188f1de200d to your computer and use it in GitHub Desktop.
CSV to json using pandas with option records
This file contains 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 | |
df = pd.read_csv('..\data\hospitals.csv') | |
#print(df.to_json(orient='records')) | |
with open('..\data\hospitals.json', 'w') as outfile: | |
outfile.write(df.to_json(orient='records')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment