Skip to content

Commit be9ab85

Browse files
gfyoungjreback
authored andcommitted
TST: Add pandas wheels to Travis build (#313)
Add pandas 0.20.1 and master to Travis. Drop 0.16.2 and Python 3.4 machines. Closes gh-307.
1 parent b903081 commit be9ab85

File tree

5 files changed

+68
-71
lines changed

5 files changed

+68
-71
lines changed

.travis.yml

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,38 @@ sudo: false
22

33
language: python
44

5-
env:
6-
- PYTHON=2.7 PANDAS=0.16.2
7-
- PYTHON=2.7 PANDAS=0.17.1
8-
- PYTHON=2.7 PANDAS=0.19.2
9-
- PYTHON=3.4 PANDAS=0.17.1
10-
- PYTHON=3.4 PANDAS=0.18.1
11-
- PYTHON=3.5 PANDAS=0.19.2
12-
- PYTHON=3.6 PANDAS=0.19.2
5+
matrix:
6+
fast_finish: true
7+
include:
8+
- os: linux
9+
env:
10+
- PYTHON=2.7 PANDAS=0.17.1
11+
- os: linux
12+
env:
13+
- PYTHON=2.7 PANDAS=0.19.2
14+
- os: linux
15+
env:
16+
- PYTHON=3.5 PANDAS=0.17.1
17+
- os: linux
18+
env:
19+
- PYTHON=3.5 PANDAS=0.18.1
20+
- os: linux
21+
env:
22+
- PYTHON=3.5 PANDAS=0.19.2
23+
- os: linux
24+
env:
25+
- PYTHON=3.6 PANDAS=0.19.2
26+
- os: linux
27+
env:
28+
- PYTHON=3.6 PANDAS=0.20.1
29+
# In allow failures
30+
- os: linux
31+
env:
32+
- PYTHON=3.6 PANDAS="MASTER"
33+
allow_failures:
34+
- os: linux
35+
env:
36+
- PYTHON=3.6 PANDAS="MASTER"
1337

1438
install:
1539
- pip install -qq flake8
@@ -30,8 +54,15 @@ install:
3054
- conda update -q conda
3155
# Useful for debugging any issues with conda
3256
- conda info -a
33-
- conda create -q -n test-environment python=$PYTHON pandas=$PANDAS coverage setuptools html5lib lxml pytest pytest-cov
57+
- conda create -q -n test-environment python=$PYTHON coverage setuptools html5lib lxml pytest pytest-cov
3458
- source activate test-environment
59+
- if [[ "$PANDAS" == "MASTER" ]]; then
60+
conda install numpy pytz python-dateutil;
61+
PRE_WHEELS="https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com";
62+
pip install --pre --upgrade --timeout=60 -f $PRE_WHEELS pandas;
63+
else
64+
conda install pandas=$PANDAS;
65+
fi
3566
- pip install beautifulsoup4
3667
- pip install coveralls --quiet
3768
- conda list

pandas_datareader/compat/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
PANDAS_VERSION = LooseVersion(pd.__version__)
99

1010
PANDAS_0190 = (PANDAS_VERSION >= LooseVersion('0.19.0'))
11-
PANDAS_0170 = (PANDAS_VERSION >= LooseVersion('0.17.0'))
12-
PANDAS_0160 = (PANDAS_VERSION >= LooseVersion('0.16.0'))
1311

1412
if PANDAS_0190:
1513
from pandas.api.types import is_number

pandas_datareader/tests/test_eurostat.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
import pytest
2-
31
import numpy as np
42
import pandas as pd
53
import pandas.util.testing as tm
64
import pandas_datareader.data as web
75

8-
from pandas_datareader.compat import PANDAS_0170
9-
106

117
class TestEurostat(tm.TestCase):
128

@@ -67,9 +63,6 @@ def test_get_sts_cobp_a(self):
6763
def test_get_nrg_pc_202(self):
6864
# see gh-149
6965

70-
if not PANDAS_0170:
71-
pytest.skip("skip because of comparison failure")
72-
7366
df = web.DataReader('nrg_pc_202', 'eurostat',
7467
start=pd.Timestamp('2010-01-01'),
7568
end=pd.Timestamp('2013-01-01'))

pandas_datareader/tests/test_wb.py

Lines changed: 23 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from pandas_datareader.wb import (search, download, get_countries,
1010
get_indicators, WorldBankReader)
11-
from pandas_datareader.compat import PANDAS_0170, PANDAS_0160
1211

1312

1413
class TestWB(tm.TestCase):
@@ -56,17 +55,12 @@ def test_wdi_download(self):
5655
expected = pd.DataFrame(expected)
5756
# Round, to ignore revisions to data.
5857
expected = np.round(expected, decimals=-3)
59-
if PANDAS_0170:
60-
expected = expected.sort_index()
61-
else:
62-
expected = expected.sort()
58+
expected = expected.sort_index()
6359

6460
result = download(country=cntry_codes, indicator=inds,
6561
start=2003, end=2004, errors='ignore')
66-
if PANDAS_0170:
67-
result = result.sort_index()
68-
else:
69-
result = result.sort()
62+
result = result.sort_index()
63+
7064
# Round, to ignore revisions to data.
7165
result = np.round(result, decimals=-3)
7266

@@ -76,10 +70,8 @@ def test_wdi_download(self):
7670
# pass start and end as string
7771
result = download(country=cntry_codes, indicator=inds,
7872
start='2003', end='2004', errors='ignore')
79-
if PANDAS_0170:
80-
result = result.sort_index()
81-
else:
82-
result = result.sort()
73+
result = result.sort_index()
74+
8375
# Round, to ignore revisions to data.
8476
result = np.round(result, decimals=-3)
8577
tm.assert_frame_equal(result, expected)
@@ -94,30 +86,21 @@ def test_wdi_download_str(self):
9486
expected = pd.DataFrame(expected)
9587
# Round, to ignore revisions to data.
9688
expected = np.round(expected, decimals=-3)
97-
if PANDAS_0170:
98-
expected = expected.sort_index()
99-
else:
100-
expected = expected.sort()
89+
expected = expected.sort_index()
10190

10291
cntry_codes = 'JP'
10392
inds = 'NY.GDP.PCAP.CD'
10493
result = download(country=cntry_codes, indicator=inds,
10594
start=2000, end=2004, errors='ignore')
106-
if PANDAS_0170:
107-
result = result.sort_index()
108-
else:
109-
result = result.sort()
95+
result = result.sort_index()
11096
result = np.round(result, decimals=-3)
11197

11298
expected.index.names = ['country', 'year']
11399
tm.assert_frame_equal(result, expected)
114100

115101
result = WorldBankReader(inds, countries=cntry_codes,
116102
start=2000, end=2004, errors='ignore').read()
117-
if PANDAS_0170:
118-
result = result.sort_index()
119-
else:
120-
result = result.sort()
103+
result = result.sort_index()
121104
result = np.round(result, decimals=-3)
122105
tm.assert_frame_equal(result, expected)
123106

@@ -126,30 +109,28 @@ def test_wdi_download_error_handling(self):
126109
inds = 'NY.GDP.PCAP.CD'
127110

128111
with tm.assertRaisesRegexp(ValueError, "Invalid Country Code\\(s\\): XX"):
129-
result = download(country=cntry_codes, indicator=inds,
130-
start=2003, end=2004, errors='raise')
112+
download(country=cntry_codes, indicator=inds,
113+
start=2003, end=2004, errors='raise')
131114

132-
if PANDAS_0160:
133-
# assert_produces_warning doesn't exists in prior versions
134-
with self.assert_produces_warning():
135-
result = download(country=cntry_codes, indicator=inds,
136-
start=2003, end=2004, errors='warn')
137-
self.assertTrue(isinstance(result, pd.DataFrame))
138-
self.assertEqual(len(result), 2)
115+
# assert_produces_warning doesn't exists in prior versions
116+
with self.assert_produces_warning():
117+
result = download(country=cntry_codes, indicator=inds,
118+
start=2003, end=2004, errors='warn')
119+
self.assertTrue(isinstance(result, pd.DataFrame))
120+
self.assertEqual(len(result), 2)
139121

140122
cntry_codes = ['USA']
141123
inds = ['NY.GDP.PCAP.CD', 'BAD_INDICATOR']
142124

143125
with tm.assertRaisesRegexp(ValueError, "The provided parameter value is not valid\\. Indicator: BAD_INDICATOR"):
126+
download(country=cntry_codes, indicator=inds,
127+
start=2003, end=2004, errors='raise')
128+
129+
with self.assert_produces_warning():
144130
result = download(country=cntry_codes, indicator=inds,
145-
start=2003, end=2004, errors='raise')
146-
147-
if PANDAS_0160:
148-
with self.assert_produces_warning():
149-
result = download(country=cntry_codes, indicator=inds,
150-
start=2003, end=2004, errors='warn')
151-
self.assertTrue(isinstance(result, pd.DataFrame))
152-
self.assertEqual(len(result), 2)
131+
start=2003, end=2004, errors='warn')
132+
self.assertTrue(isinstance(result, pd.DataFrame))
133+
self.assertEqual(len(result), 2)
153134

154135
def test_wdi_download_w_retired_indicator(self):
155136

pandas_datareader/wb.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import numpy as np
88

99
from pandas_datareader.base import _BaseReader
10-
from pandas_datareader.compat import PANDAS_0170
1110

1211
# This list of country codes was pulled from wikipedia during October 2014.
1312
# While some exceptions do exist, it is the best proxy for countries supported
@@ -178,11 +177,8 @@ def read(self):
178177
out = reduce(lambda x, y: x.merge(y, how='outer'), data)
179178
out = out.drop('iso_code', axis=1)
180179
out = out.set_index(['country', 'year'])
181-
if PANDAS_0170:
182-
out = out.apply(pd.to_numeric, errors='ignore')
183-
else:
184-
# deprecated in 0.17.0
185-
out = out.convert_objects(convert_numeric=True)
180+
out = out.apply(pd.to_numeric, errors='ignore')
181+
186182
return out
187183
else:
188184
msg = "No indicators returned data."
@@ -275,11 +271,9 @@ def get_list_of_values(x):
275271

276272
data.topics = data.topics.apply(get_list_of_values)
277273
data.topics = data.topics.apply(lambda x: ' ; '.join(x))
278-
# Clean outpu
279-
if PANDAS_0170:
280-
data = data.sort_values(by='id')
281-
else:
282-
data = data.sort(columns='id')
274+
275+
# Clean output
276+
data = data.sort_values(by='id')
283277
data.index = pd.Index(lrange(data.shape[0]))
284278

285279
# cache

0 commit comments

Comments
 (0)