OliverSherouse / wbdata

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

Martinique / MTQ is missing from wbdata #64

Closed Bojangels closed 6 months ago

Bojangels commented 3 years ago

A query using wbdata does not return data, despite it being available on the WB website. For example, compare:

https://databank.worldbank.org/reports.aspx?source=worldwide-governance-indicators#`

With the following script:

import wbdata

data_dates = (datetime.datetime(2019,1,1), datetime.datetime(2019,1,1))

MTQ_missing = wbdata.get_dataframe({'PV.EST':'values'}, country=('MTQ'), data_date=data_dates, convert_date=False, keep_levels=True)

Which returns:


IndexError Traceback (most recent call last) /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/wbdata/fetcher.py in fetch(url, args, cache) 123 try: --> 124 results.extend(response[1]) 125 this_page = response[0]["page"]

IndexError: list index out of range

During handling of the above exception, another exception occurred:

RuntimeError Traceback (most recent call last)

in ----> 1 MTQ_missing = wbdata.get_dataframe({'PV.EST':'values'}, 2 country=('MTQ'), data_date=data_dates, convert_date=False, keep_levels=True) in get_dataframe(indicators, country, data_date, freq, source, convert_date, keep_levels, cache) /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/wbdata/api.py in uses_pandas(f, *args, **kwargs) 83 if not pd: 84 raise ValueError("Pandas must be installed to be used") ---> 85 return f(*args, **kwargs) 86 87 /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/wbdata/api.py in get_dataframe(indicators, country, data_date, freq, source, convert_date, keep_levels, cache) 480 :returns: a WBDataFrame 481 """ --> 482 serieses = [ 483 ( 484 get_series( /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/wbdata/api.py in (.0) 482 serieses = [ 483 ( --> 484 get_series( 485 indicator=indicator, 486 country=country, /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/wbdata/api.py in get_series(indicator, country, data_date, freq, source, convert_date, column_name, keep_levels, cache) 184 :returns: WBSeries 185 """ --> 186 raw_data = get_data( 187 indicator=indicator, 188 country=country, /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/wbdata/api.py in get_data(indicator, country, data_date, freq, source, convert_date, pandas, column_name, keep_levels, cache) 287 if source: 288 args["source"] = source --> 289 data = fetcher.fetch(query_url, args, cache=cache) 290 if convert_date: 291 data = convert_dates_to_datetime(data) /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/wbdata/fetcher.py in fetch(url, args, cache) 128 try: 129 message = response[0]["message"][0] --> 130 raise RuntimeError( 131 f"Got error {message['id']} ({message['key']}): " 132 f"{message['value']}" RuntimeError: Got error 120 (Invalid value): The provided parameter value is not valid
OliverSherouse commented 3 years ago

This is apparently an error upstream. http://api.worldbank.org/v2/country/MTQ gives the same error. Unfortunately, that means I can't do anything about it.

Bojangels commented 3 years ago

I see. Thank you for clarifying. It's an odd upstream error because you can still view Martinqiue here: https://info.worldbank.org/governance/wgi/Home/Reports and here https://databank.worldbank.org/reports.aspx?source=worldwide-governance-indicators#%60 (andeven export the data as MTQ).

Appreciate your work!

On Tue, Oct 27, 2020 at 10:03 AM Oliver Sherouse notifications@github.com wrote:

This is apparently an error upstream. http://api.worldbank.org/v2/country/MTQ gives the same error. Unfortunately, that means I can't do anything about it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OliverSherouse/wbdata/issues/64#issuecomment-717265599, or unsubscribe https://github.com/notifications/unsubscribe-auth/APF4ANU5TGPBNCUVYP7ZUVLSM3HJXANCNFSM4TAD2NUQ .