TransWikia.com

Converting a multi index dictionary output into Pandas dataframe

Data Science Asked by Harvey 2020 on December 24, 2020

I need help in converting this data into pandas dataframe. Challenge here is data is in nested dictionary format and the no of elements present in every row changes on few cases.

    {'totalcount': 2,
         'appointments': [{'date': '11/01/2020',
           'cancelreasonname': 'CANCELLED FROM API',
           'appointmentid': '1179879',
           'patient': {'firstname': 'Pbtest',
            'primarydepartmentid': '1',
            'portaltermsonfile': 'false',
            'status': 'active',
            'lastname': 'Pbtest',
            'state': 'IL',
            'email': '[email protected]',
            'balances': [{'departmentlist': '1,21,102,145,148,150,157,162,166,168',
              'balance': 0,
              'providergroupid': '1',
              'cleanbalance': 'true'}],
            'city': 'CHICAGO',
            'race': [],
            'emailexists': 'true',
            'departmentid': '1',
            'confidentialitycode': 'N',
            'patientid': '18032',
            'registrationdate': '10/21/2020',
            'hasmobile': 'true',
            'address2': 'Pb',
            'privacyinformationverified': 'false',
            'zip': '12356',
            'consenttotext': 'false',
            'guarantoraddresssameaspatient': 'false',
            'address1': 'D91',
            'guarantorrelationshiptopatient': '1',
            'driverslicense': 'false',
            'patientphoto': 'false'},
           'starttime': '00:00',
           'cancelledby': 'API-16070',
           'departmentid': '1',
           'appointmentstatus': 'x',
           'scheduledby': 'API-16070',
           'cancelreasonnoshow': False,
           'patientid': '18032',
           'duration': 30,
           'templateappointmenttypeid': '4',
           'hl7providerid': 325,
           'lastmodifiedby': 'API-16070',
           'appointmentcopay': {'collectedforother': 0,
            'collectedforappointment': 0,
            'insurancecopay': 0},
           'cancelreasonid': '-5',
           'copay': 0,
           'cancelreasonslotavailable': True,
           'appointmenttypeid': '4',
           'lastmodified': '10/28/2020 08:56:00',
           'appointmenttype': 'PHYSICAL EXAM',
           'providerid': '325',
           'chargeentrynotrequired': False,
           'scheduleddatetime': '10/28/2020 08:54:55',
           'coordinatorenterprise': False,
           'templateappointmentid': '1179879',
           'cancelleddatetime': '10/28/2020 08:56:00',
           'appointmentnotes': [{'displayonschedule': False,
             'text': 'API appointment cancellation. Reported reason for cancellation: Cancelled appointment',
             'id': 47451}],
           'patientappointmenttypename': 'Physical Exam Visit'},
          {'date': '11/01/2020',
           'appointmentid': '1180694',
           'patient': {'firstname': 'Pbtest',
            'primarydepartmentid': '1',
            'portaltermsonfile': 'false',
            'status': 'active',
            'lastname': 'Pbtest',
            'state': 'IL',
            'email': '[email protected]',
            'balances': [{'balance': 0,
              'departmentlist': '1,21,102,145,148,150,157,162,166,168',
              'providergroupid': '1',
              'cleanbalance': 'true'}],
            'city': 'CHICAGO',
            'race': [],
            'emailexists': 'true',
            'departmentid': '1',
            'confidentialitycode': 'N',
            'patientid': '18032',
            'registrationdate': '10/21/2020',
            'hasmobile': 'true',
            'address2': 'Pb',
            'privacyinformationverified': 'false',
            'zip': '12356',
            'consenttotext': 'false',
            'countrycode3166': 'US',
            'guarantoraddresssameaspatient': 'false',
            'address1': 'D91',
            'guarantorrelationshiptopatient': '1',
            'driverslicense': 'false',
            'patientphoto': 'false'},
           'starttime': '00:00',
           'departmentid': '1',
           'appointmentstatus': 'f',
           'scheduledby': 'API-16070',
           'patientid': '18032',
           'duration': 30,
           'templateappointmenttypeid': '4',
           'hl7providerid': 325,
           'lastmodifiedby': 'API-16070',
           'appointmentcopay': {'collectedforother': 0,
            'collectedforappointment': 0,
            'insurancecopay': 0},
           'copay': 0,
           'appointmenttypeid': '4',
           'lastmodified': '10/29/2020 09:07:03',
           'appointmenttype': 'PHYSICAL EXAM',
           'providerid': '325',
           'chargeentrynotrequired': False,
           'scheduleddatetime': '10/29/2020 09:07:03',
           'coordinatorenterprise': False,
           'templateappointmentid': '1179879',
           'appointmentnotes': [{'displayonschedule': False,
             'text': 'Updated Note',
             'id': 47461}],
           'patientappointmenttypename': 'Physical Exam Visit'}]}   
 

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP