Skip to content

DOC: Document that read_hdf can use pickle #35554

New issue

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

Merged
merged 3 commits into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions doc/source/user_guide/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3441,10 +3441,11 @@ for some advanced strategies

.. warning::

pandas requires ``PyTables`` >= 3.0.0.
There is a indexing bug in ``PyTables`` < 3.2 which may appear when querying stores using an index.
If you see a subset of results being returned, upgrade to ``PyTables`` >= 3.2.
Stores created previously will need to be rewritten using the updated version.
Pandas uses PyTables for reading and writing HDF5 files, which allows
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that this only applies to fixed stores; tables do not use pickle

serializing object-dtype data with pickle. Loading pickled data received from
untrusted sources can be unsafe.

See: https://docs.python.org/3/library/pickle.html for more.

.. ipython:: python
:suppress:
Expand Down
51 changes: 50 additions & 1 deletion pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,15 @@ def read_hdf(
Read from the store, close it if we opened it.

Retrieve pandas object stored in file, optionally based on where
criteria
criteria.

.. warning::

Pandas uses PyTables for reading and writing HDF5 files, which allows
serializing object-dtype data with pickle when using the "fixed" format.
Loading pickled data received from untrusted sources can be unsafe.

See: https://docs.python.org/3/library/pickle.html for more.

Parameters
----------
Expand Down Expand Up @@ -445,6 +453,14 @@ class HDFStore:

Either Fixed or Table format.

.. warning::

Pandas uses PyTables for reading and writing HDF5 files, which allows
serializing object-dtype data with pickle when using the "fixed" format.
Loading pickled data received from untrusted sources can be unsafe.

See: https://docs.python.org/3/library/pickle.html for more.

Parameters
----------
path : str
Expand Down Expand Up @@ -789,6 +805,14 @@ def select(
"""
Retrieve pandas object stored in file, optionally based on where criteria.

.. warning::

Pandas uses PyTables for reading and writing HDF5 files, which allows
serializing object-dtype data with pickle when using the "fixed" format.
Loading pickled data received from untrusted sources can be unsafe.

See: https://docs.python.org/3/library/pickle.html for more.

Parameters
----------
key : str
Expand Down Expand Up @@ -852,6 +876,15 @@ def select_as_coordinates(
"""
return the selection as an Index

.. warning::

Pandas uses PyTables for reading and writing HDF5 files, which allows
serializing object-dtype data with pickle when using the "fixed" format.
Loading pickled data received from untrusted sources can be unsafe.

See: https://docs.python.org/3/library/pickle.html for more.


Parameters
----------
key : str
Expand All @@ -876,6 +909,14 @@ def select_column(
return a single column from the table. This is generally only useful to
select an indexable

.. warning::

Pandas uses PyTables for reading and writing HDF5 files, which allows
serializing object-dtype data with pickle when using the "fixed" format.
Loading pickled data received from untrusted sources can be unsafe.

See: https://docs.python.org/3/library/pickle.html for more.

Parameters
----------
key : str
Expand Down Expand Up @@ -912,6 +953,14 @@ def select_as_multiple(
"""
Retrieve pandas objects from multiple tables.

.. warning::

Pandas uses PyTables for reading and writing HDF5 files, which allows
serializing object-dtype data with pickle when using the "fixed" format.
Loading pickled data received from untrusted sources can be unsafe.

See: https://docs.python.org/3/library/pickle.html for more.

Parameters
----------
keys : a list of the tables
Expand Down