You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The question is why the user.id is wrong? It returns the development_plan.id. Adding the complete user dictionary does return the correct user.id though.
Is this a bug or am I missing something?
The text was updated successfully, but these errors were encountered:
records = []
for entry in data:
status = entry['status']
user_id = entry['user']['id']
development_plan_id = entry['development_plan']['id']
for item in entry['development_plan']['items']:
record = {
'id': item['id'],
'item_name': item['item_name'],
'development_plan_id': development_plan_id,
'status': status,
'user_id': user_id
}
records.append(record)
Create DataFrame
df = pd.DataFrame(records)
print(df)
I got the following result:
id item_name development_plan_id status user_id
0 176498 itemname 1 23858 on_track 714067
1 172450 itemname 2 23858 on_track 714067
2 172451 itemname 3 23858 on_track 714067
Thank you for your response, yes it works. But doesn't use the json_normalize functionality? I am using this function to parse a multitude of api's and their responses. I configure their record_path and meta data columns in configuration data.
I would like to avoid creating a unique way to parse every API.
Research
I have searched the [pandas] tag on StackOverflow for similar questions.
I have asked my usage related question on StackOverflow.
Link to question on StackOverflow
Pandas json_normalize question
Question about pandas
I am trying to understand an issue I encounter with json_normalize. This may be a bug?
The following code:
Returns this dataframe:
0 176498 itemname 1 23858 on_track 23858 {'id': 714067}
1 172450 itemname 2 23858 on_track 23858 {'id': 714067}
2 172451 itemname 3 23858 on_track 23858 {'id': 714067}
The question is why the user.id is wrong? It returns the development_plan.id. Adding the complete user dictionary does return the correct user.id though.
Is this a bug or am I missing something?
The text was updated successfully, but these errors were encountered: