Skip to content

Commit 0e109b1

Browse files
paradox-labnoatamir
authored andcommitted
TST: add test case for PeriodIndex in HDFStore(GH7796) (pandas-dev#48618)
* TST: add test case for PeriodIndex in HDFStore * TST: add test case for PeriodIndex in HDFStore * use pytest.mark.parameterize instead
1 parent 41f424e commit 0e109b1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pandas/tests/io/pytables/test_put.py

+14
Original file line numberDiff line numberDiff line change
@@ -365,3 +365,17 @@ def make_index(names=None):
365365
)
366366
store.append("df", df)
367367
tm.assert_frame_equal(store.select("df"), df)
368+
369+
370+
@pytest.mark.parametrize("format", ["fixed", "table"])
371+
def test_store_periodindex(setup_path, format):
372+
# GH 7796
373+
# test of PeriodIndex in HDFStore
374+
df = DataFrame(
375+
np.random.randn(5, 1), index=pd.period_range("20220101", freq="M", periods=5)
376+
)
377+
378+
with ensure_clean_path(setup_path) as path:
379+
df.to_hdf(path, "df", mode="w", format=format)
380+
expected = pd.read_hdf(path, "df")
381+
tm.assert_frame_equal(df, expected)

0 commit comments

Comments
 (0)