Skip to content

Commit 92b5322

Browse files
dacoexjreback
authored andcommitted
DOC: Hdf warning about using attribute access on hierarchical keys
Author: DaCoEx <[email protected]> Closes #12276 from dacoex/hdf_warning and squashes the following commits: 17e013d [DaCoEx] added warning for retrieving from groups, now separate PR
1 parent 8a9e643 commit 92b5322

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

doc/source/io.rst

+22
Original file line numberDiff line numberDiff line change
@@ -2910,6 +2910,28 @@ everything in the sub-store and BELOW, so be *careful*.
29102910
store.remove('food')
29112911
store
29122912
2913+
.. warning::
2914+
2915+
Hierarchical keys cannot be retrieved as dotted (attribute) access as described above for items stored under the root node.
2916+
2917+
.. code-block:: python
2918+
2919+
In [8]: store.foo.bar.bah
2920+
AttributeError: 'HDFStore' object has no attribute 'foo'
2921+
2922+
# you can directly access the actual PyTables node but using the root node
2923+
In [9]: store.root.foo.bar.bah
2924+
Out[9]:
2925+
/foo/bar/bah (Group) ''
2926+
children := ['block0_items' (Array), 'block0_values' (Array), 'axis0' (Array), 'axis1' (Array)]
2927+
2928+
Instead, use explicit string based keys
2929+
2930+
.. ipython:: python
2931+
2932+
store['foo/bar/bah']
2933+
2934+
29132935
.. _io.hdf5-types:
29142936

29152937
Storing Types

0 commit comments

Comments
 (0)