'Python, creating a Dataframe from JSONL received from a URL
I am making a graphql call to an API. The response comes back as a URL with a JSONL file. I want to read this to a dataframe without downloading it to my local machine. I have so far been unable to do this after trying for some time. I don't have a lot of code to display as of writing this.
#Response to Graphql, use requests.get to retrieve JSONL
response = requests.get('''LONG URL LINK.jsonl&response-content-type=application%2Fjsonl''')
txt = resp
df = pd.read_json(resp, lines=True)
The above code errors out with
ValueError: Invalid file path or buffer object type: <class 'requests.models.Response'>
If I just call
df = pd.DataFrame(txt)
Then I do get a dataframe, but it only contains one column when I expect multiple. Looking for how I can read this JSONL url to dataframe and any insight is appreciated!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
