I am trying to turn JSON data into a Pandas dataframe in Python.
Whenever I use df = pd.json_normalize(data)
The output is 1 rows x 285750 columns. Screenshot of output in Jupyter Notebook
I am ultimately trying to get a dataframe that has a row for each item 'name'
This is a sample of the JSON:
{
"success": true,
"currency": "USD",
"timestamp": 1644687375,
"items_list": {
"'Blueberries' Buckshot | NSWC SEAL": {
"name": "'Blueberries' Buckshot | NSWC SEAL",
"price": {
"7_days": {
"average": 1.46,
"median": 1.45,
"sold": "50",
"standard_deviation": "5.38",
"lowest_price": 1.33,
"highest_price": 1.54
},
"30_days": {
"average": 1.43,
"median": 1.43,
"sold": "3157",
"standard_deviation": "5.51",
"lowest_price": 1.06,
"highest_price": 1.58
},
"all_time": {
"average": 1.2,
"median": 1.39,
"sold": "123024",
"standard_deviation": "14.02",
"lowest_price": 0.83,
"highest_price": 1.74
}
},
"first_sale_date": "1607036400"
},
"'Medium Rare' Crasswater | Guerrilla Warfare": {
"name": "'Medium Rare' Crasswater | Guerrilla Warfare",
"price": {
"7_days": {
"average": 4.68,
"median": 4.66,
"sold": "49",
"standard_deviation": "1.68",
"lowest_price": 4.55,
"highest_price": 4.81
},
"30_days": {
"average": 4.58,
"median": 4.58,
"sold": "4584",
"standard_deviation": "5.15",
"lowest_price": 3.71,
"highest_price": 5.21
},
"all_time": {
"average": 7.24,
"median": 4.76,
"sold": "30250",
"standard_deviation": "22.02",
"lowest_price": 3.71,
"highest_price": 15.16
}
},
"first_sale_date": "1632348000"
}
}
}
I'm very new to coding in general, so I opted to not include the other solutions I've tried incase they are erroneous or don't make sense. Thanks in advance for any help!
source https://stackoverflow.com/questions/71094994/pandas-json-normalize-outputs-only-1-huge-row
Comments
Post a Comment