Skip to content

Commit 59ae8ef

Browse files
authored
Merge pull request #979 from bashtage/formatting
STY: Improve style and fix FF reader
2 parents e9f03d3 + 209310e commit 59ae8ef

File tree

4 files changed

+30
-28
lines changed

4 files changed

+30
-28
lines changed

pandas_datareader/famafrench.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ def _read_zipfile(self, url):
5858
tmpf.write(raw)
5959

6060
with ZipFile(tmpf, "r") as zf:
61-
data = zf.open(zf.namelist()[0]).read().decode('utf-8','ignore')
62-
61+
data = zf.open(zf.namelist()[0]).read().decode("utf-8", "ignore")
6362

6463
return data
6564

@@ -89,7 +88,7 @@ def _read_one_data(self, url, params):
8988
else:
9089
c = ["Count"]
9190
r = list(range(0, 105, 5))
92-
params["names"] = ["Date"] + c + list(zip(r, r[1:], strict=True))
91+
params["names"] = ["Date"] + c + list(zip(r, r[1:], strict=False))
9392

9493
if self.symbols != "Prior_2-12_Breakpoints":
9594
params["skiprows"] = 1

pandas_datareader/oecd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ class OECDReader(_BaseReader):
1212
@property
1313
def url(self):
1414
"""API URL"""
15-
url = "http://stats.oecd.org/SDMX-JSON/data"
15+
url = "https://stats.oecd.org/SDMX-JSON/data"
1616

1717
if not isinstance(self.symbols, str):
1818
raise ValueError("data name must be string")
1919

2020
# API: https://data.oecd.org/api/sdmx-json-documentation/
21-
return "{0}/{1}/all/all?".format(url, self.symbols)
21+
return "{0}/{1}/all/all".format(url, self.symbols)
2222

2323
def _read_lines(self, out):
2424
"""read one data from specified URL"""

pandas_datareader/tests/test_famafrench.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,32 +62,32 @@ def test_f_f_research(self):
6262
6.82,
6363
],
6464
"SMB": [
65-
0.37,
65+
0.40,
6666
1.19,
67-
1.44,
68-
4.86,
69-
0.14,
70-
-1.84,
71-
0.18,
72-
-3.02,
73-
3.93,
74-
1.07,
75-
3.78,
76-
0.68,
67+
1.48,
68+
4.87,
69+
0.09,
70+
-1.82,
71+
0.20,
72+
-3.00,
73+
3.96,
74+
1.14,
75+
3.77,
76+
0.73,
7777
],
7878
"HML": [
79-
0.33,
80-
3.19,
81-
2.11,
82-
2.91,
83-
-2.39,
84-
-4.52,
85-
-0.36,
79+
0.43,
80+
3.23,
81+
2.21,
82+
2.89,
83+
-2.44,
84+
-4.70,
85+
-0.31,
8686
-1.90,
87-
-3.23,
88-
-2.46,
89-
-0.95,
90-
3.64,
87+
-3.16,
88+
-2.43,
89+
-0.96,
90+
3.70,
9191
],
9292
"RF": [
9393
0.00,

pandas_datareader/tests/test_tiingo.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ def test_tiingo_metadata(symbols):
6464

6565

6666
def test_tiingo_no_api_key(symbols):
67-
from test.support import EnvironmentVarGuard
67+
try:
68+
from test.support.os_helper import EnvironmentVarGuard
69+
except ImportError:
70+
from test.support import EnvironmentVarGuard
6871

6972
env = EnvironmentVarGuard()
7073
env.unset("TIINGO_API_KEY")

0 commit comments

Comments
 (0)