Python Forum
Nested array API call, how to split into its own column?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Nested array API call, how to split into its own column?
#1
Hello,

I am new here and new to Data Science. In advance, I am thankful for any help. I am working with this API: https://npiregistry.cms.hhs.gov/api/demo?version=2.1

I am using enumertaion_type=2 as one of the parameters. This causes the two addresses to be dumped into one column in arrays, that are separated by a column.
This is an example of the result of my query but limited to one facility for space here:

Output:
{'result_count': 73, 'results': [{'enumeration_type': 'NPI-2', 'number': 1407855935, 'last_updated_epoch': 1514419200, 'created_epoch': 1121644800, 'basic': {'organization_name': 'CENTRAL KENTUCKY INTERVENTIONAL PAIN CENTER, PLLC', 'organizational_subpart': 'NO', 'enumeration_date': '2005-07-18', 'last_updated': '2017-12-28', 'status': 'A', 'authorized_official_credential': 'MD', 'authorized_official_first_name': 'KHURSHEED', 'authorized_official_last_name': 'SIDDIQUI', 'authorized_official_telephone_number': '859-236-0606', 'authorized_official_title_or_position': 'OWNER/GROUP PRESIDENT', 'name': 'CENTRAL KENTUCKY INTERVENTIONAL PAIN CENTER, PLLC'}, 'other_names': [], 'addresses': [{'country_code': 'US', 'country_name': 'United States', 'address_purpose': 'LOCATION', 'address_type': 'DOM', 'address_1': '300 W BROADWAY ST', 'address_2': '', 'city': 'DANVILLE', 'state': 'KY', 'postal_code': '404221408', 'telephone_number': '859-236-0606', 'fax_number': '859-236-0066'}, {'country_code': 'US', 'country_name': 'United States', 'address_purpose': 'MAILING', 'address_type': 'DOM', 'address_1': 'PO BOX 7096', 'address_2': '', 'city': 'STOCKTON', 'state': 'CA', 'postal_code': '952670096', 'telephone_number': '209-956-7725', 'fax_number': '209-956-7733'}],[/color] 'taxonomies': [{'code': '174400000X', 'desc': 'Specialist', 'primary': False, 'state': 'KY', 'license': '28741', 'taxonomy_group': '193200000X MULTI-SPECIALTY GROUP'}, {'code': '207LP2900X', 'desc': 'Anesthesiology Pain Medicine', 'primary': False, 'state': '', 'license': '', 'taxonomy_group': '193200000X MULTI-SPECIALTY GROUP'}, {'code': '208VP0000X', 'desc': 'Pain Medicine Pain Medicine', 'primary': True, 'state': '', 'license': '', 'taxonomy_group': '193200000X MULTI-SPECIALTY GROUP'}, {'code': '208VP0014X', 'desc': 'Pain Medicine Interventional Pain Medicine', 'primary': False, 'state': '', 'license': '', 'taxonomy_group': '193200000X MULTI-SPECIALTY GROUP'}], 'identifiers': [{'identifier': '65942906', 'code': '05', 'desc': 'MEDICAID', 'state': 'KY', 'issuer': ''}]},
I have the address in its own dataframe but need it split. There are two arrays for all of those fields for each provider. I only need the first address information with the 'address_purpose' = 'Location'. I am unable to split those two arrays into two columns and not able to drop the second array.

My goal is to have [Address_1] [Address_2] [City] [State] [Zip] [telephone_number] as columns. I then can add that to the dataframe housing all the other information I need. If someone could help me splitting the two arrays up, I can take it from there.

Thank you!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  attempt to split values from within a dataframe column mbrown009 8 2,354 Apr-10-2023, 02:06 AM
Last Post: mbrown009
  [split] Array in numpy aapurdel 1 2,117 May-25-2019, 08:05 PM
Last Post: buran
  NumPy array; selecting the a single column econmajor 0 3,055 Oct-24-2017, 04:25 PM
Last Post: econmajor

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020