Created
March 23, 2020 20:13
-
-
Save nkthiebaut/86e549f00385ca142d1657a1b06bff4c to your computer and use it in GitHub Desktop.
Pandas : column of JSON strings to DataFrame
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
# inspired by https://stackoverflow.com/a/50658993/5174617 | |
import pandas as pd | |
import json | |
df = pd.DataFrame([['0 {"a":"1","b":"2","c":"3"}'],['1 {"a" :"4","b":"5","c":"6"}']], columns=['json']) | |
exploded_df = df['json'].apply(json.loads).apply(pd.Series) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment