Skip to content

Commit a67b731

Browse files
author
Kevin Sheppard
committed
UPD: Update for upstream changes in DataFrame.convert_objects
Update convert_objects use to new syntax. xref pandas-dev/pandas#10265
1 parent 5979a6c commit a67b731

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pandas_datareader/wb.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
from __future__ import print_function
44

5+
from distutils.version import LooseVersion
6+
57
from pandas.compat import map, reduce, range, lrange
68
from pandas.io.common import urlopen
79
from pandas.io import json
810
import pandas
911
import numpy as np
1012
import warnings
1113

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

0 commit comments

Comments
 (0)