Skip to content

Commit 9e9d63c

Browse files
authored
Merge pull request #474 from bashtage/update-reqs
Update reqs
2 parents 9ff8939 + efe04c6 commit 9e9d63c

File tree

9 files changed

+140
-76
lines changed

9 files changed

+140
-76
lines changed

.coveragerc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# .coveragerc to control coverage.py
2+
[run]
3+
source = pandas_datareader
4+
branch = True
5+
include = */pandas_datareader/*
6+
omit =
7+
*/_version.py
8+
*/yahoo/*
9+
*/google/options.py
10+
*/google/quotes.py
11+
*/tests/google/test_options.py
12+
13+
[report]
14+
# Regexes for lines to exclude from consideration
15+
exclude_lines =
16+
# Have to re-enable the standard pragma
17+
pragma: no cover
18+
# Don't complain if tests don't hit defensive assertion code:
19+
raise NotImplementedError
20+
raise ImmediateDeprecationError
21+
# Ignore pass
22+
pass
23+
include = */pandas_datareader/*
24+
omit =
25+
*/_version.py
26+
*/yahoo/*
27+
*/google/options.py
28+
*/google/quotes.py
29+
*/tests/google/test_options.py
30+
ignore_errors = True

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ install:
7171

7272
script:
7373
- export ENIGMA_API_KEY=$ENIGMA_API_KEY
74-
- pytest -s -r xX --cov=pandas_datareader --cov-report xml:/tmp/cov-datareader.xml --junitxml=/tmp/datareader.xml
74+
- pytest -s -r xX --cov-config .coveragerc --cov=pandas_datareader --cov-report xml:/tmp/cov-datareader.xml --junitxml=/tmp/datareader.xml
7575
- flake8 --version
7676
- flake8 pandas_datareader
7777

README.rst

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,6 @@ Up to date remote data access for pandas, works for multiple versions of pandas.
3131
although there are frequent reports of failures. Failure is frequently
3232
encountered when bulk downloading historical price data.
3333

34-
Installation
35-
------------
36-
37-
38-
Install latest release version via pip
39-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40-
41-
.. code-block:: shell
42-
43-
$ pip install pandas-datareader
44-
45-
Install latest development version
46-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47-
48-
.. code-block:: shell
49-
50-
$ pip install git+https://github.com/pydata/pandas-datareader.git
51-
52-
or
53-
54-
.. code-block:: shell
55-
56-
$ git clone https://github.com/pydata/pandas-datareader.git
57-
$ python setup.py install
58-
5934
Usage
6035
-----
6136

@@ -84,4 +59,49 @@ A second copy of the stable documentation is hosted on
8459
`read the docs <https://pandas-datareader.readthedocs.io/>`_ for more details.
8560

8661
`Development documentation <https://pydata.github.io/pandas-datareader/devel/>`__
87-
is available for the latest changes in master.
62+
is available for the latest changes in master.
63+
64+
Installation
65+
------------
66+
67+
Requirements
68+
~~~~~~~~~~~~
69+
70+
Using pandas datareader requires the following packages:
71+
72+
* pandas>=0.19.2
73+
* lxml
74+
* requests>=2.3.0
75+
* requests-file
76+
* requests-ftp
77+
* wrapt
78+
79+
Building the documentation additionally requires:
80+
81+
* matplotlib
82+
* ipython
83+
* sphinx
84+
* sphinx_rtd_theme
85+
86+
Testing requires pytest.
87+
88+
Install latest release version via pip
89+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
90+
91+
.. code-block:: shell
92+
93+
$ pip install pandas-datareader
94+
95+
Install latest development version
96+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97+
98+
.. code-block:: shell
99+
100+
$ pip install git+https://github.com/pydata/pandas-datareader.git
101+
102+
or
103+
104+
.. code-block:: shell
105+
106+
$ git clone https://github.com/pydata/pandas-datareader.git
107+
$ python setup.py install

pandas_datareader/compat/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
PANDAS_0190 = (PANDAS_VERSION >= LooseVersion('0.19.0'))
1212
PANDAS_0200 = (PANDAS_VERSION >= LooseVersion('0.20.0'))
13+
PANDAS_0210 = (PANDAS_VERSION >= LooseVersion('0.21.0'))
1314

1415
if PANDAS_0190:
1516
from pandas.api.types import is_number

pandas_datareader/tests/io/data/jsdmx/land_use.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

pandas_datareader/tests/io/data/jsdmx/tourism.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

pandas_datareader/tests/io/test_jsdmx.py

Lines changed: 49 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,69 +8,78 @@
88
import pytest
99

1010
from pandas_datareader.io import read_jsdmx
11+
from pandas_datareader.compat import PANDAS_0210
1112

1213

1314
class TestJSDMX(object):
1415

1516
def setup_method(self, method):
1617
self.dirpath = tm.get_data_path()
1718

18-
@pytest.mark.xfail(reason='Parsing error')
19+
@pytest.mark.skipif(not PANDAS_0210, reason='Broken on old pandas')
1920
def test_tourism(self):
2021
# OECD -> Industry and Services -> Inbound Tourism
2122
result = read_jsdmx(os.path.join(self.dirpath, 'jsdmx',
2223
'tourism.json'))
2324
assert isinstance(result, pd.DataFrame)
25+
jp = result['Japan']
26+
visitors = ['China', 'Hong Kong, China',
27+
'Total international arrivals',
28+
'Korea', 'Chinese Taipei', 'United States']
2429

25-
exp_col = pd.MultiIndex.from_product(
26-
[['Japan'], ['China', 'Hong Kong, China',
27-
'Total international arrivals',
28-
'Total international receipts',
29-
'International passenger transport receipts',
30-
'International travel receipts',
31-
'Korea', 'Chinese Taipei', 'United States']],
32-
names=['Country', 'Variable'])
33-
exp_idx = pd.DatetimeIndex(['2004', '2005', '2006', '2007',
34-
'2008', '2009', '2010', '2011',
35-
'2012'], name='Year')
36-
37-
values = np.array([
38-
[616, 300, 6138, 1550, 330, 1220, 1588, 1081, 760],
39-
[653, 299, 6728, 1710, 340, 1370, 1747, 1275, 822],
40-
[812, 352, 7334, 1330, 350, 980, 2117, 1309, 817],
41-
[942, 432, 8347, 1460, 360, 1100, 2601, 1385, 816],
42-
[1000, 550, 8351, 1430, 310, 1120, 2382, 1390, 768],
43-
[1006, 450, 6790, 1170, 210, 960, 1587, 1024, 700],
44-
[1413, 509, 8611, 1350, 190, 1160, 2440, 1268, 727],
45-
[1043, 365, 6219, 1000, 100, 900, 1658, 994, 566],
46-
[1430, 482, 8368, 1300, 100, 1200, 2044, 1467, 717]])
30+
exp_col = pd.Index(
31+
['China', 'Hong Kong, China', 'Total international arrivals',
32+
'Korea', 'Chinese Taipei', 'United States'],
33+
name='Variable')
34+
exp_idx = pd.DatetimeIndex(['2008-01-01', '2009-01-01', '2010-01-01',
35+
'2011-01-01', '2012-01-01', '2013-01-01',
36+
'2014-01-01', '2015-01-01', '2016-01-01'],
37+
name='Year')
38+
values = [
39+
[1000000.0, 550000.0, 8351000.0, 2382000.0, 1390000.0, 768000.0],
40+
[1006000.0, 450000.0, 6790000.0, 1587000.0, 1024000.0, 700000.0],
41+
[1413000.0, 509000.0, 8611000.0, 2440000.0, 1268000.0, 727000.0],
42+
[1043000.0, 365000.0, 6219000.0, 1658000.0, 994000.0, 566000.0],
43+
[1430000.0, 482000.0, 8368000.0, 2044000.0, 1467000.0, 717000.0],
44+
[1314000.0, 746000.0, 10364000.0, 2456000.0, 2211000.0, 799000.0],
45+
[2409000.0, 926000.0, 13413000.0, 2755000.0, 2830000.0, 892000.0],
46+
[4993689.0, 1524292.0, 19737409.0, 4002095.0, 3677075.0,
47+
1033258.0],
48+
[6373564.0, 1839193.0, 24039700.0, 5090302.0, 4167512.0, 1242719.0]
49+
]
50+
values = np.array(values, dtype='object')
4751
expected = pd.DataFrame(values, index=exp_idx, columns=exp_col)
48-
tm.assert_frame_equal(result, expected)
52+
tm.assert_frame_equal(jp[visitors], expected)
4953

50-
@pytest.mark.xfail(reason='Parsing error')
54+
@pytest.mark.skipif(not PANDAS_0210, reason='Broken on old pandas')
5155
def test_land_use(self):
5256
# OECD -> Environment -> Resources Land Use
5357
result = read_jsdmx(os.path.join(self.dirpath, 'jsdmx',
5458
'land_use.json'))
5559
assert isinstance(result, pd.DataFrame)
5660
result = result.loc['2010':'2011']
5761

62+
cols = ['Arable land and permanent crops',
63+
'Arable and cropland % land area',
64+
'Total area', 'Forest', 'Forest % land area',
65+
'Land area', 'Permanent meadows and pastures',
66+
'Meadows and pastures % land area', 'Other areas',
67+
'Other % land area']
5868
exp_col = pd.MultiIndex.from_product([
5969
['Japan', 'United States'],
60-
['Arable land and permanent crops',
61-
'Arable and cropland % land area',
62-
'Total area', 'Forest', 'Forest % land area',
63-
'Land area', 'Permanent meadows and pastures',
64-
'Meadows and pastures % land area', 'Other areas',
65-
'Other % land area']], names=['Country', 'Variable'])
70+
cols], names=['Country', 'Variable'])
6671
exp_idx = pd.DatetimeIndex(['2010', '2011'], name='Year')
67-
values = np.array([[45930, 12.601, 377950, 249790, 68.529, 364500,
68-
np.nan, np.nan, 68780, 18.87, 1624330, 17.757,
69-
9831510, 3040220, 33.236, 9147420, 2485000,
70-
27.166, 1997870, 21.841],
71-
[45610, 12.513, 377955, 249878, 68.554, 364500,
72-
np.nan, np.nan, 69012, 18.933, 1627625, 17.793,
73-
9831510, 3044048, 33.278, 9147420, 2485000,
74-
27.166, 1990747, 21.763]])
72+
values = [
73+
[53790.0, 14.753154141525, 377800.0, np.nan, np.nan, 364600.0,
74+
5000.0, 1.3713658804169, np.nan, np.nan,
75+
1897990.0, 20.722767650476, 9629090.0, np.nan, np.nan, 9158960.0,
76+
2416000.0, 26.378540795025, np.nan,
77+
np.nan],
78+
[53580.0, 14.691527282698, 377800.0, np.nan, np.nan, 364700.0,
79+
5000.0, 1.3709898546751, np.nan, np.nan,
80+
1897990.0, 20.722767650476, 9629090.0, np.nan, np.nan, 9158960.0,
81+
2416000.0, 26.378540795025, np.nan,
82+
np.nan]]
83+
values = np.array(values)
7584
expected = pd.DataFrame(values, index=exp_idx, columns=exp_col)
76-
tm.assert_frame_equal(result, expected)
85+
tm.assert_frame_equal(result[exp_col], expected)

requirements.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
lxml
2-
numpy
3-
pandas
4-
pytest
5-
requests
6-
requests_file
7-
requests_ftp
2+
pandas>=0.19.2
3+
pytest>=3
4+
requests>=2.3.0
5+
requests-file
6+
requests-ftp
87
wrapt
8+
# Documentation Only
9+
matplotlib
10+
ipython
11+
sphinx
12+
sphinx_rtd_theme

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def readme():
1414

1515

1616
INSTALL_REQUIRES = (
17-
['pandas>=0.17.0', 'requests>=2.3.0', 'requests-file', 'requests-ftp']
17+
['pandas>=0.19.2', 'requests>=2.3.0', 'requests-file', 'requests-ftp', 'wrapt', 'lxml']
1818
)
1919

2020
setup(

0 commit comments

Comments
 (0)