Skip to content

Instantly share code, notes, and snippets.

@mdiener21
Created January 17, 2017 23:41
Show Gist options
  • Save mdiener21/1f08b04bc5f87248b361c188f1de200d to your computer and use it in GitHub Desktop.
Save mdiener21/1f08b04bc5f87248b361c188f1de200d to your computer and use it in GitHub Desktop.
CSV to json using pandas with option records
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