

I first imported JSON and pandas in my notebook. I downloaded the data from postman as you did and saved it to a JSON file. data = json.load(open('json_example.json')) I did this slightly differently from you, but I think the outcome is the same. I also parsed out the data object in the payload to make it easier for this example. I used pd.json_normalize to create the data frame. I started with reference_tweets and separated this further.
のダウンロード方法-02.png)
This is based on the “not so good solution” from this article. As indicated in the medium article, you can do the merge right away, but I personally prefer to do it step by step to have more control. I also renamed the new df columns to it add easier to add the columns to the primary data frame. new_df = df.apply(pd.Series)ĭf = normįor the ntions object, this was a bit more complex because the file I had up to 2 mentions per Tweet. Now you can view your main data frame, and you should see the new columns you created.Įnt_df = df.apply(pd.Series)ĭf = newĭf = new_b Your file may have more mentions per Tweet. You may also want to drop any remaining columns with the data we parsed out. Hi all, I am new here and might be asking the same question as the one that has been answered 20 days ago, but if so I didn’t really get the answer…! It would be referenced_tweets and ntions.Īlso, I have passed on the feedback that data nested in this way can be difficult to work with to the product team, for us to consider as we make future improvements. I am using the academic API to get tweets between september and november 2019 in Sweden.
