From 74de074e37f522666d23405ee637338bc7d6b65a Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Tue, 14 Jan 2020 12:43:10 -0800 Subject: [PATCH 1/2] REG: restore format_type attr --- pandas/io/pytables.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 9e8d8a2e89f20..c36c9eb730c7c 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -2472,6 +2472,7 @@ class Fixed: """ pandas_kind: str + format_type: str = "fixed" # GH#30962 needed by dask obj_type: Type[Union[DataFrame, Series]] ndim: int encoding: str @@ -3127,6 +3128,7 @@ class Table(Fixed): """ pandas_kind = "wide_table" + format_type: str = "table" # GH#30962 needed by dask table_type: str levels = 1 is_table = True From 247e18710cf8ede9bf2b49b7df2ecf88165f2de5 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Tue, 21 Jan 2020 15:33:06 -0600 Subject: [PATCH 2/2] test --- pandas/tests/io/pytables/test_store.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pandas/tests/io/pytables/test_store.py b/pandas/tests/io/pytables/test_store.py index 64c4ad800f49d..f56d042093886 100644 --- a/pandas/tests/io/pytables/test_store.py +++ b/pandas/tests/io/pytables/test_store.py @@ -64,6 +64,16 @@ @pytest.mark.single class TestHDFStore: + def test_format_type(self, setup_path): + df = pd.DataFrame({"A": [1, 2]}) + with ensure_clean_path(setup_path) as path: + with HDFStore(path) as store: + store.put("a", df, format="fixed") + store.put("b", df, format="table") + + assert store.get_storer("a").format_type == "fixed" + assert store.get_storer("b").format_type == "table" + def test_format_kwarg_in_constructor(self, setup_path): # GH 13291