Created
December 18, 2020 11:01
-
-
Save thanakijwanavit/629428f931e0923ed42a29c430c25a27 to your computer and use it in GitHub Desktop.
format a dictionary into list form
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 | |
| import json | |
| df = pd.DataFrame({'hello':['1','2','2'], 'world':['1','2','3']}) | |
| df | |
| tableDict = df.to_dict(orient='list') | |
| json.dumps(tableDict) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment