Skip to content

UPD: Update for upstream changes in DataFrame.convert_objects #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 20, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions pandas_datareader/wb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

from __future__ import print_function

from pandas.compat import map, reduce, range, lrange
from distutils.version import LooseVersion
import warnings

from pandas.compat import reduce, lrange
from pandas.io.common import urlopen
from pandas.io import json
import pandas
import numpy as np
import warnings

PD017 = LooseVersion(pandas.__version__) > LooseVersion('0.16.2')
# This list of country codes was pulled from wikipedia during October 2014.
# While some exceptions do exist, it is the best proxy for countries supported
# by World Bank. It is an aggregation of the 2-digit ISO 3166-1 alpha-2, and
Expand Down Expand Up @@ -155,7 +158,12 @@ def download(country=['MX', 'CA', 'US'], indicator=['NY.GDP.MKTP.CD', 'NY.GNS.IC
out = reduce(lambda x, y: x.merge(y, how='outer'), data)
out = out.drop('iso_code', axis=1)
out = out.set_index(['country', 'year'])
out = out.convert_objects(convert_numeric=True)
if PD017:
kwargs = dict((kw, True)
for kw in ('datetime', 'numeric', 'timedelta'))
else:
kwargs = {'convert_numeric': True}
out = out.convert_objects(**kwargs)
return out
else:
msg = "No indicators returned data."
Expand Down