Skip to content

Commit d5068ea

Browse files
meeseeksmachinejbrockmendel
authored andcommitted
Backport PR #31017: REG: restore format_type attr (#31206)
Co-authored-by: jbrockmendel <[email protected]>
1 parent c103002 commit d5068ea

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pandas/io/pytables.py

+2
Original file line numberDiff line numberDiff line change
@@ -2474,6 +2474,7 @@ class Fixed:
24742474
"""
24752475

24762476
pandas_kind: str
2477+
format_type: str = "fixed" # GH#30962 needed by dask
24772478
obj_type: Type[Union[DataFrame, Series]]
24782479
ndim: int
24792480
encoding: str
@@ -3132,6 +3133,7 @@ class Table(Fixed):
31323133
"""
31333134

31343135
pandas_kind = "wide_table"
3136+
format_type: str = "table" # GH#30962 needed by dask
31353137
table_type: str
31363138
levels = 1
31373139
is_table = True

pandas/tests/io/pytables/test_store.py

+10
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@
6464

6565
@pytest.mark.single
6666
class TestHDFStore:
67+
def test_format_type(self, setup_path):
68+
df = pd.DataFrame({"A": [1, 2]})
69+
with ensure_clean_path(setup_path) as path:
70+
with HDFStore(path) as store:
71+
store.put("a", df, format="fixed")
72+
store.put("b", df, format="table")
73+
74+
assert store.get_storer("a").format_type == "fixed"
75+
assert store.get_storer("b").format_type == "table"
76+
6777
def test_format_kwarg_in_constructor(self, setup_path):
6878
# GH 13291
6979

0 commit comments

Comments
 (0)