Skip to content

Replacement(region, value) Source

Settings of the replacement of a region of an Array, used by Array.replace.

Added in version 0.1.0

Parameters:

  • region (Region)

    The positions to replace.

  • value (ScalarValue | Array)

    A ScalarValue, such as 0 or "Paris", written at every position of the region, or an Array of exactly the shape of the region. Its type must fit in the type of the Array: a decimal cannot replace an integer.

Raises:

Examples:

import numdaplot as ndp

scores = ndp.Array.from_list([10, 20, 30])
first_score = ndp.Region(rows=ndp.Index(0))
scores.replace(ndp.Replacement(region=first_score, value=0))
# Array([ 0, 20, 30], dtype=INT64)