datatree.DataTree.drop_nodes#

DataTree.drop_nodes(names: str | Iterable[str], *, errors: ErrorOptions = 'raise') DataTree[source][source]#

Drop child nodes from this node.

Parameters
  • names (str or iterable of str) – Name(s) of nodes to drop.

  • errors ({"raise", "ignore"}, default: "raise") – If ‘raise’, raises a KeyError if any of the node names passed are not present as children of this node. If ‘ignore’, any given names that are present are dropped and no error is raised.

Returns

dropped (DataTree) – A copy of the node with the specified children dropped.