Skip to content

Region(rows=None, columns=None) Source

A rectangular part of an Array or a Table, chosen by position, used by take and replace.

Changed in version 0.2.0

Accepts First and Last for the rows and the columns.

Version history (1)

Added in version 0.1.0

Parameters:

  • rows (Index | Range | First | Last | None, default: None)

    The rows to take: one Index, a Range, or the First or Last rows. Every row when omitted, but a Region needs rows, columns or both.

  • columns (Index | Range | First | Last | list[str] | None, default: None)

    The columns to take: one Index, a Range, the First or Last columns, or a list of column names for a Table. Every column when omitted. The region keeps its own copy of a list of names.

Raises:

Examples:

import numdaplot as ndp

grid = ndp.Array.from_list([[1, 2, 3], [4, 5, 6]])
grid.take(ndp.Region(rows=ndp.Index(0), columns=ndp.Range(start=1, stop=2)))
# Array([[2, 3]], dtype=INT64)