Skip to content

Commit 7e02574

Browse files
committed
Fix for legacy python
1 parent 9463416 commit 7e02574

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

pandas_datareader/compat/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from io import StringIO
2+
import sys
23
from urllib.error import HTTPError
34

45
from pandas.api.types import is_list_like, is_number
@@ -12,7 +13,7 @@
1213
"assert_frame_equal",
1314
"is_list_like",
1415
"is_number",
15-
"reduce",
16+
"PYTHON_LT_3_10",
1617
]
1718

1819

@@ -31,3 +32,6 @@ def get_filepath_or_buffer(filepath_or_buffer, encoding=None, compression=None):
3132
filepath_or_buffer, encoding=encoding, compression=None
3233
)
3334
return tmp
35+
36+
37+
PYTHON_LT_3_10 = sys.version_info <= (3, 10)

pandas_datareader/famafrench.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pandas import read_csv, to_datetime
77

88
from pandas_datareader.base import _BaseReader
9-
from pandas_datareader.compat import StringIO
9+
from pandas_datareader.compat import PYTHON_LT_3_10, StringIO
1010

1111
_URL = "http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/"
1212
_URL_PREFIX = "ftp/"
@@ -87,7 +87,8 @@ def _read_one_data(self, url, params):
8787
else:
8888
c = ["Count"]
8989
r = list(range(0, 105, 5))
90-
params["names"] = ["Date"] + c + list(zip(r, r[1:], strict=False))
90+
kwargs = {} if PYTHON_LT_3_10 else {"strict": False}
91+
params["names"] = ["Date"] + c + list(zip(r, r[1:], **kwargs))
9192

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

0 commit comments

Comments
 (0)