Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas as pd
path = '/tmp/df.h5'
df = pd.DataFrame(range(10))
with pd.HDFStore(path, 'w') as out_hdf:
out_hdf.put('/a/b', df, format='fixed', complib='zlib', complevel=6)
Issue Description
The error trace is:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/Users/alex/miniconda3/envs/py39/lib/python3.9/site-packages/pandas/io/pytables.py", line 1122, in put
self._write_to_group(
File "/Users/alex/miniconda3/envs/py39/lib/python3.9/site-packages/pandas/io/pytables.py", line 1769, in _write_to_group
raise ValueError("Compression not supported on Fixed format stores")
ValueError: Compression not supported on Fixed format stores
The following two lines work:
out_hdf.put(key, df, format='fixed', complevel=6)
out_hdf.put(key, df, format='table', complib='zlib', complevel=6)
but when you combine those it fails
out_hdf.put(key, df, format='fixed', complib='zlib', complevel=6)
With that ValueError.
Expected Behavior
It should be possible to compress a fixed format store. xref PyTables/PyTables#953
Installed Versions
INSTALLED VERSIONS
commit : 4bfe3d0
python : 3.9.12.final.0
python-bits : 64
OS : Darwin
OS-release : 21.4.0
Version : Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.4.2
numpy : 1.21.5
pytz : 2022.1
dateutil : 2.8.2
pip : 22.1
setuptools : 62.1.0
Cython : 0.29.28
pytest : 7.1.2
hypothesis : None
sphinx : 4.5.0
blosc : None
feather : None
xlsxwriter : 3.0.3
lxml.etree : 4.8.0
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.3.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : 1.3.4
brotli :
fastparquet : None
fsspec : 2022.3.0
gcsfs : None
markupsafe : 2.1.1
matplotlib : 3.5.2
numba : 0.55.1
numexpr : 2.8.0
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : 8.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.8.0
snappy : None
sqlalchemy : 1.4.36
tables : 3.7.0
tabulate : None
xarray : None
xlrd : 2.0.1
xlwt : 1.3.0
zstandard : None