api-python icon indicating copy to clipboard operation
api-python copied to clipboard

get_places_in proposal

Open lukesmurray opened this issue 6 years ago • 0 comments

If I want to get a list of dcids for states in the United States I currently have to use one of the following two options.

# input is a list of dcids
# output is a dictionary with one key
dc.get_places_in(['country/USA'], 'State')['country/USA']
# input is a series of dcids
# output is a list with one element
dc.get_places_in(pd.Series(['country/USA']), 'State')[0]

I would prefer to be able to put in one string and get the output as a list.

>>> df.get_places_in('country/USA', 'State')
[u'geoId/41',
 u'geoId/31',
 u'geoId/12',
 u'geoId/39',
...
 u'geoId/22',
]

lukesmurray avatar Aug 07 '19 23:08 lukesmurray