Skip to content

Commit 0eb3818

Browse files
kdietherjreback
authored andcommitted
Modified get_data_famafrench(name) to allow for all file
extensions. Fixes error when getting "F-F_Momentum_Factor" data (uses a .TXT extension instead of .txt) Added a release note in doc/source/releast.rst referencing 6470 Changed the github reference to 6460
1 parent 4c663be commit 0eb3818

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

doc/source/release.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ Bug Fixes
174174
- Regression in ``MultiIndex.from_product`` with a ``DatetimeIndex`` as input (:issue:`6439`)
175175
- Bug in ``str.extract`` when passed a non-default index (:issue:`6348`)
176176
- Bug in ``str.split`` when passed ``pat=None`` and ``n=1`` (:issue:`6466`)
177+
- Bug in ``io.data.DataReader`` when passed ``"F-F_Momentum_Factor"`` and ``data_source="famafrench"`` (:issue:`6460`)
177178

178179
pandas 0.13.1
179180
-------------

pandas/io/data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ def get_data_famafrench(name):
494494
tmpf.write(raw)
495495

496496
with ZipFile(tmpf, 'r') as zf:
497-
data = zf.open(name + '.txt').readlines()
497+
data = zf.open(zf.namelist()[0]).readlines()
498498

499499
line_lengths = np.array(lmap(len, data))
500500
file_edges = np.where(line_lengths == 2)[0]

pandas/io/tests/test_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ def test_read_fred(self):
387387
def test_read_famafrench(self):
388388
for name in ("F-F_Research_Data_Factors",
389389
"F-F_Research_Data_Factors_weekly", "6_Portfolios_2x3",
390-
"F-F_ST_Reversal_Factor"):
390+
"F-F_ST_Reversal_Factor","F-F_Momentum_Factor"):
391391
ff = DataReader(name, "famafrench")
392392
assert ff
393393
assert isinstance(ff, dict)

0 commit comments

Comments
 (0)