Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

is_hollow method #272

Merged
merged 6 commits into from
Oct 25, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
narrative docs
  • Loading branch information
TomNicholas committed Oct 25, 2023
commit c48325399585cb0e6660a3c94da4278d3110c515
19 changes: 19 additions & 0 deletions docs/source/hierarchical-data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,25 @@ You can see this tree is similar to the ``dt`` object above, except that it is m

(If you want to keep the name of the root node, you will need to add the ``name`` kwarg to :py:class:`from_dict`, i.e. ``DataTree.from_dict(non_empty_nodes, name=dt.root.name)``.)

.. _Tree Contents:

Tree Contents
-------------

Hollow Trees
~~~~~~~~~~~~

A concept that can sometimes be useful is that of a "Hollow Tree", which means a tree with data stored only at the leaf nodes.
This is useful because certain useful tree manipulation operations only make sense for hollow trees.

You can check if a tree is a hollow tree by using the :py:meth:`~DataTree.is_hollow` property.
We can see that the Simpson's family is not hollow because the data variable ``"age"`` is present at some nodes which
have children (i.e. Abe and Homer).

.. ipython:: python

simpsons.is_hollow

.. _manipulating trees:

Manipulating Trees
Expand Down
Loading