Skip to content

Commit 78891d7

Browse files
committed
Added test to reproduce issue #16583
1 parent 2e24a8f commit 78891d7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/io/test_pytables.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5247,6 +5247,16 @@ def test_query_compare_column_type(self):
52475247
expected = df.loc[[], :]
52485248
tm.assert_frame_equal(expected, result)
52495249

5250+
def test_read_hdf_series_fixed(self):
5251+
# GH 16583
5252+
# Tests that reading a Series saved to an HDF file in 'fixed' format
5253+
# still works if a mode='r' argument is supplied
5254+
series = tm.makeFloatSeries()
5255+
with ensure_clean_path(self.path) as path:
5256+
series.to_hdf(path, key='data', format='fixed')
5257+
result = pd.read_hdf(path, key='data', mode='r')
5258+
tm.assert_series_equal(result, series)
5259+
52505260
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Need python 3.6")
52515261
def test_fspath(self):
52525262
with tm.ensure_clean('foo.h5') as path:

0 commit comments

Comments
 (0)