Skip to content

ColumnChoice(columns, mode=ColumnMode.KEEP) Source

Columns to keep or to drop, used by Table.choose_columns.

Added in version 0.1.0

Parameters:

  • columns (list[str])

    The names of the columns. The choice keeps its own copy of the list.

  • mode (ColumnMode, default: ColumnMode.KEEP)

    KEEP by default, keeping only these columns, in the order of the list, or DROP to remove them.

Raises:

Examples:

import numdaplot as ndp

cities = ndp.Array.from_list(["Paris", "Lyon", "Paris"])
prices = ndp.Array.from_list([120.0, 80.0, 150.0])
sales = ndp.Table.from_arrays({"city": cities, "price": prices})
sales.choose_columns(ndp.ColumnChoice(columns=["price"]))
#     price
#   FLOAT64
# 0   120.0
# 1    80.0
# 2   150.0