I am trying to convert a JSON derived from the patentsview API into a pandas dataframe. However it is difficult because it seems to be a nested JSON!
Here is my code:
import requests
import pandas as pd
from pandas.io.json import json_normalize
import json
url = 'http://www.patentsview.org/api/patents/query?q={"cpc_group_id":"B60W"}&f=["inventor_first_name","inventor_last_name","patent_number", "assignee_country"]'
r = requests.get(url)
json_data = r.json()
df = pd.DataFrame(json_data['patents'])
df
See the image for the dataframe that is returned.
My question is how can I get the nested dictionary keys and their values into unique columns?