Skip to content

Commit 1982faa

Browse files
committed
Making adjustments to meet flake8 requirements.
1 parent ad98428 commit 1982faa

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

pandas_datareader/econdb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def read(self):
2525
""" read one data from specified URL """
2626
results = requests.get(self.url).json()['results']
2727
df = pd.DataFrame({'dates': []}).set_index('dates')
28-
28+
2929
if self._show == 'labels':
3030
def show_func(x): return x.split(':')[1]
3131
elif self._show == 'codes':

pandas_datareader/tests/test_eurostat.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,24 @@
99
class TestEurostat(object):
1010

1111
def test_get_ert_h_eur_a(self):
12-
# Former euro area national currencies vs. euro/ECU - annual data (ert_h_eur_a)
12+
# Former euro area national currencies vs. euro/ECU
13+
# annual data (ert_h_eur_a)
1314
df = web.DataReader('ert_h_eur_a', 'eurostat',
1415
start=pd.Timestamp('2009-01-01'),
1516
end=pd.Timestamp('2010-01-01'))
1617
assert isinstance(df, pd.DataFrame)
1718

18-
df = df["National currency (former currencies of the euro area countries)"]
19-
df = df["Average"][["Italian lira", "Lithuanian litas"]]
19+
header = df.columns.levels[0][0]
20+
currencies = ["Italian lira", "Lithuanian litas"]
21+
df = df[header]
22+
df = df["Average"][currencies]
2023

21-
exp_col = pd.MultiIndex.from_product([['Italian lira', 'Lithuanian litas'], ['Annual']],
22-
names=['CURRENCY', 'FREQ'])
23-
exp_idx = pd.DatetimeIndex(['2009-01-01', '2010-01-01'], name='TIME_PERIOD')
24+
exp_col = pd.MultiIndex.from_product([currencies, ['Annual']],
25+
names=['CURRENCY', 'FREQ'])
26+
exp_idx = pd.DatetimeIndex(['2009-01-01', '2010-01-01'],
27+
name='TIME_PERIOD')
2428
values = np.array([[1936.27, 3.4528],
25-
[1936.27, 3.4528]])
29+
[1936.27, 3.4528]])
2630
expected = pd.DataFrame(values, index=exp_idx, columns=exp_col)
2731
tm.assert_frame_equal(df, expected)
2832

pandas_datareader/tests/test_nasdaq.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import pandas_datareader
21
import pandas_datareader.data as web
32
from pandas_datareader._utils import RemoteDataError
43
from pandas_datareader._testing import skip_on_exception

pandas_datareader/tests/yahoo/test_yahoo.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def test_yahoo_reader_class(self):
241241
def test_yahoo_DataReader(self):
242242
start = datetime(2010, 1, 1)
243243
end = datetime(2015, 5, 9)
244-
# yahoo will adjust for dividends by default
244+
# yahoo will adjust for dividends by default
245245
result = web.DataReader('AAPL', 'yahoo-actions', start, end)
246246

247247
exp_idx = pd.DatetimeIndex(['2015-05-07', '2015-02-05',
@@ -264,8 +264,9 @@ def test_yahoo_DataReader(self):
264264
exp.index.name = 'Date'
265265
tm.assert_frame_equal(result.reindex_like(exp).round(2), exp.round(2))
266266

267-
# where adjust_dividends = True
268-
result = web.get_data_yahoo_actions('AAPL', start, end, adjust_dividends=False)
267+
# where dividends are not adjusted for splits
268+
result = web.get_data_yahoo_actions('AAPL', start, end,
269+
adjust_dividends=False)
269270

270271
exp = pd.DataFrame({'action': ['DIVIDEND', 'DIVIDEND', 'DIVIDEND',
271272
'DIVIDEND', 'SPLIT', 'DIVIDEND',

0 commit comments

Comments
 (0)