Skip to content

[API v1.0.0 Feedback] Failure to process entire series if index is not contiguous #99

@beets

Description

@beets

This code snippet should reproduce the error:

df = pd.DataFrame({'container': ['geoId/13']})
df['city'] = dc.get_places_in(df['container'], 'City')
df = dc.flatten_frame(df)
props = {'healthOutcome': "CDC_BPHigh"}
df['pops'] = dc.get_populations(df['city'], 'Person', props)
df['pops'].replace('', np.nan, inplace=True)
df.dropna(inplace=True)
df['bpHigh'] = dc.get_observations(df['pops'], 'prevalence', 'measuredValue', '2015', measurement_method='CDC_AgeAdjustedPrevalence')
df

Note a bunch of NaN's, where we expect data from each population. The fix seems to be:

test = df.reset_index(drop=True)
test['bpHigh'] = dc.get_observations(test['pops'], 'prevalence', 'measuredValue', '2015', measurement_method='CDC_AgeAdjustedPrevalence')
test

Here's a notebook with the code
https://colab.research.google.com/drive/1sSLtLmI_jo5T7poNlydY0QWghHerZMpj

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions