OliverSherouse / wbdata

A python library for accessing world bank data
GNU General Public License v2.0
180 stars 55 forks source link

get_country(incomelevel="OEC") produces "IndexError: list index out of range" error #28

Closed MaxGhenis closed 5 years ago

MaxGhenis commented 5 years ago

The readthedocs documentation includes this line:

countries = [i['id'] for i in wbdata.get_country(incomelevel="OEC", display=False)]

This returns the error:

IndexError: list index out of range

The same error is returned with the simpler:

wbdata.get_country(incomelevel="OEC")

And other incomelevel values like oec, OECD, and oecd also produce this error.

get_country() without the incomelevel argument works fine.

Function documentation doesn't include more information like a list of valid incomelevel values: https://github.com/OliverSherouse/wbdata/blob/0541f6da9d1d867ce58badfb96d6648c754fe2aa/wbdata/api.py#L253-L261

MaxGhenis commented 5 years ago

wbdata.get_incomelevel() shows that some incomelevel values are gone, including OEC: image

I'll make a PR replacing the example with HIC.

MaxGhenis commented 5 years ago

Proposed in https://github.com/OliverSherouse/wbdata/pull/30.

OliverSherouse commented 5 years ago

Thanks for the fix.