skip to Main Content

flatten a json using json_normalize

I have the following nested dictionary with lists inside: [{ "id": 467, "status": 2, "leavePeriod": { "owner": { "employeeNumber": "2620", "firstName": "fn_467", "lastName": "ln_467" }, "ownerId": 46, "leaves": [ { "leaveAccount": { "id": 1121, "name": "Vacation days 2021/2022", "url": "https://some_link/1121"…

VIEW QUESTION

Json – Python flatten a dictionary column

It should be a simple line of code using pd.json_normalize function but it's working only with a single string and it's not batch processing my whole column Orginial dataframe df['addresses'][0] [{'addressLine1': '124 Main Street', 'addressLine2': '', 'addressLine3': '', 'city': 'Portland',…

VIEW QUESTION

Create JSON object literal only if value is not null

I wrote a script which updates some fields in a database via an API. fields = [{ "fieldId": "101", "fieldValues": [{"value": df["A"].item()}]}, { "fieldId": "102", "fieldValues": [{"value": df["B"].item()}]}, { "fieldId": "103", "fieldValues": [{"value": df["C"].item()}]}, { "fieldId": "104", "fieldValues": [{"value": df["D"].item()}]},…

VIEW QUESTION
Back To Top
Search