Skip to content

Commit

Permalink
UPD: Update for upstream changes in DataFrame.convert_objects
Browse files Browse the repository at this point in the history
Update convert_objects use to new syntax.

xref pandas-dev/pandas#10265
  • Loading branch information
Kevin Sheppard committed Jul 15, 2015
1 parent 5979a6c commit a67b731
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion 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 distutils.version import LooseVersion

from pandas.compat import map, reduce, range, 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,8 @@ 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)
kw = 'numeric' if PD017 else 'convert_numeric'
out = out.convert_objects(**{kw: True})
return out
else:
msg = "No indicators returned data."
Expand Down

0 comments on commit a67b731

Please sign in to comment.