constructing dataframe from json semi-manually

This commit is contained in:
spbeach46 2020-09-30 23:50:36 -07:00
parent 643e475dec
commit 21804923a5

View File

@ -1,7 +1,7 @@
import requests
import json
from bs4 import BeautifulSoup as b
import pandas as pd
params = {
"callname":"GetMultipleItems",
@ -16,4 +16,12 @@ response = requests.get("https://open.api.ebay.com/shopping?", params=params) #
data = response.json()
pretty_data = json.dumps(data, indent=2)
df = pd.read_json(data, 'Item')
nvl = df.iloc[0]['ItemSpecifics.NameValueList']
nvl_dict = {}
for item in nvl:
nvl['Name']
# departments = ["3034","93427"]
# Best plan of action is probably json-->pandas df. You can decide how to clean later, but it
# will prolly be easier if you clean in pandas because you can drop columns easily that you don't
# need. Figure out how to "flatten" your json data into the df first.