Skip to main content
`Ctrl`+`K`

# skbio.tree.TreeNode.pop

TreeNode.pop(index=-1, uncache=True)

  Remove and return a child node by index position from self.

  Parameters:
    index int, optional

      The index position in `children` to pop.

    uncache bool, optional

      Whether to clear caches of the tree if present (default: True). See `details`.

      Added in version 0.6.3.

  Returns:
    TreeNode

      The popped child node.

  Raises:
    IndexError

      If the index position does not exist.

  See also

  `remove`
  `remove_by_func`

  Notes

  The parent of the popped node will be set to `None`.

  Examples

      >>> from skbio import TreeNode
      >>> tree = TreeNode.read(["(a,b)c;"])
      >>> print(tree.pop(0))
      a;