We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import pandas as pd df = pd.DataFrame({'a': range(10), 'b': range(10)}) df.to_hdf('/tmp/1.hdf', 'k1') try: pd.read_hdf('/tmp/1.hdf', 'k2') except Exception as e: print(type(e)) print(e) df.to_hdf('/tmp/1.hdf', 'k2')
<type 'exceptions.KeyError'> 'No object named k2 in the file'
The file '/tmp/1.hdf' is already opened, but in read-only mode. Please close it before reopening in append mode.
should not raise Exception when: df.to_hdf('/tmp/1.hdf', 'k2')
except (ValueError, TypeError): # should also catch KeyError
pd.show_versions()
commit: None python: 2.7.12.final.0 python-bits: 64 OS: Linux OS-release: 4.4.0-141-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: zh_CN.UTF-8 LOCALE: None.None
pandas: 0.24.2 pytest: 3.2.4 pip: 19.0.1 setuptools: 39.1.0 Cython: 0.27.3 numpy: 1.14.5 scipy: 1.1.0 pyarrow: None xarray: None IPython: 5.5.0 sphinx: 1.6.5 patsy: 0.4.1 dateutil: 2.6.1 pytz: 2017.3 blosc: None bottleneck: None tables: 3.4.2 numexpr: 2.6.4 feather: None matplotlib: 2.1.0 openpyxl: 2.4.9 xlrd: 1.1.0 xlwt: 1.3.0 xlsxwriter: 1.0.2 lxml.etree: 4.1.1 bs4: 4.6.0 html5lib: 0.9999999 sqlalchemy: 1.1.15 pymysql: None psycopg2: 2.7.3.2 (dt dec pq3 ext lo64) jinja2: 2.10 s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None gcsfs: None
The text was updated successfully, but these errors were encountered:
Thanks for the report! PRs are always welcome
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Code Sample, a copy-pastable example if possible
Problem description
<type 'exceptions.KeyError'>
'No object named k2 in the file'
The file '/tmp/1.hdf' is already opened, but in read-only mode. Please close it before reopening in append mode.
Expected Output
should not raise Exception when: df.to_hdf('/tmp/1.hdf', 'k2')
pandas/io/pytables.py line 408
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-141-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: zh_CN.UTF-8
LOCALE: None.None
pandas: 0.24.2
pytest: 3.2.4
pip: 19.0.1
setuptools: 39.1.0
Cython: 0.27.3
numpy: 1.14.5
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 5.5.0
sphinx: 1.6.5
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: None
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.1.0
openpyxl: 2.4.9
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml.etree: 4.1.1
bs4: 4.6.0
html5lib: 0.9999999
sqlalchemy: 1.1.15
pymysql: None
psycopg2: 2.7.3.2 (dt dec pq3 ext lo64)
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: