Skip to content

Array(*arguments, **keyword_arguments) Source

Values of one type in one or several dimensions, wrapping a numpy array.

An Array never changes: every operation returns a new Array.

Calling ndp.Array(...), comparisons, brackets, for, in, len, bool and @ are refused with RefusedOperationError, which names the method to use instead.

Added in version 0.1.0

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([12.5, 8.0, 30.0])
prices
# Array([12.5,  8. , 30. ], dtype=FLOAT64)
prices.shape
# Shape(dimensions=[3])
prices.dtype
# <Type.FLOAT64: 10>

Creation

from_list(values, dtype=None) Source

Create an Array from a Python list, or from nested lists for several dimensions.

The type is guessed when omitted: integers give INT64, decimals or a mix of integers and decimals give FLOAT64, then BOOL, TEXT, DATE, DATETIME and DURATION. None is a missing value, only accepted for decimals, texts, dates, datetimes and durations.

Added in version 0.1.0

Parameters:

  • values (NestedValues)

    The values, a NestedValues such as [1, 2, 3], ["Paris", None] or [[1, 2], [3, 4]]. Nested lists must form a regular block.

  • dtype (Type | None, default: None)

    The type to store the values as, guessed from the values when omitted. Required when no value is present.

Returns:

  • Self

    A new Array.

Raises:

Examples:

import numdaplot as ndp

ndp.Array.from_list([[1, 2], [3, None]], dtype=ndp.Type.FLOAT64)
# Array([[ 1.,  2.],
#        [ 3., nan]], dtype=FLOAT64)

from_numpy(values) Source

Create an Array from a copy of a numpy array; changing the numpy array never changes the Array.

Added in version 0.1.0

Parameters:

  • values (numpy.typing.NDArray[Any])

    The numpy array. Texts may mark their missing values with any marker of StringDType. Durations of any unit give DURATION, and an object array of datetime.time and None gives TIME.

Returns:

  • Self

    A new Array.

Raises:

Examples:

import numpy
import numdaplot as ndp

ndp.Array.from_numpy(numpy.array([1.5, 2.5]))
# Array([1.5, 2.5], dtype=FLOAT64)

filled(shape, value, dtype=None) Source

Create an Array of a shape, with the same value everywhere.

Added in version 0.1.0

Parameters:

  • shape (Shape)

    The shape of the Array.

  • value (ScalarValue)

    The repeated value, a ScalarValue such as 0, "Paris" or True.

  • dtype (Type | None, default: None)

    The type to store the value as, guessed from the value when omitted.

Returns:

  • Self

    A new Array.

Raises:

Examples:

import numdaplot as ndp

ndp.Array.filled(shape=ndp.Shape([2, 3]), value=0)
# Array([[0, 0, 0],
#        [0, 0, 0]], dtype=INT64)

from_range(sequence) Source

Create a one-dimensional Array of the numbers of a regular sequence.

Unlike the Python range, the stop is included by default.

Added in version 0.1.0

Parameters:

  • sequence (Range)

    The start, the stop, the step and the bounds kept. LOW_ONLY keeps the start and drops the stop, HIGH_ONLY the opposite.

Returns:

  • Self

    A new Array of integers when the start and the step are integers, of decimals otherwise.

Raises:

Examples:

import numdaplot as ndp

ndp.Array.from_range(ndp.Range(start=0, stop=1, step=0.25))
# Array([0.  , 0.25, 0.5 , 0.75, 1.  ], dtype=FLOAT64)

from_date_parts(parts) Source

Create an Array of dates from their year, their month and their day, such as three columns of a file.

Added in version 0.1.0

Parameters:

  • parts (DateParts)

    The year, the month and the day of each date, Arrays of whole numbers of the same shape.

Returns:

  • Self

    A new DATE Array of the shape of the parts. A date is missing where one of its parts is missing.

Raises:

  • InvalidTypeError

    When an argument is not of the type its annotation names.

  • ValueConversionError

    At the first part that is not a whole number, such as the day 3.5, then at the first year, month and day that form no date, such as the 31st of February, a month 13 or a year outside 1 to 9999.

Examples:

import numdaplot as ndp

accidents = ndp.Table.from_arrays(
    {
        "jour": ndp.Array.from_list([14, 25]),
        "mois": ndp.Array.from_list([7, 12]),
        "an": ndp.Array.from_list([2025, 2025]),
    }
)
years = accidents.column("an")
parts = ndp.DateParts(year=years, month=accidents.column("mois"), day=accidents.column("jour"))
ndp.Array.from_date_parts(parts)
# Array(['2025-07-14', '2025-12-25'], dtype=DATE)

from_spacing(spacing) Source

Create a one-dimensional Array of evenly spaced decimals.

Added in version 0.1.0

Parameters:

  • spacing (Spacing)

    The bounds, the count of values and whether each bound is among them.

Returns:

  • Self

    A new FLOAT64 Array of count values.

Raises:

Examples:

import numdaplot as ndp

ndp.Array.from_spacing(ndp.Spacing(start=0, stop=1, count=5))
# Array([0.  , 0.25, 0.5 , 0.75, 1.  ], dtype=FLOAT64)

random(distribution, shape, seed=None) Source

Create an Array of values drawn at random from a distribution.

Added in version 0.1.0

Parameters:

  • distribution (Uniform | Normal | RandomIntegers)

    The Distribution followed by the values, such as ndp.Uniform(low=0, high=10): see Distribution for every distribution.

  • shape (Shape)

    The shape of the Array.

  • seed (int | None, default: None)

    A number, at least 0, giving the same values at each call. Different values at each call when omitted.

Returns:

Raises:

Examples:

import numdaplot as ndp

dice = ndp.RandomIntegers(low=1, high=6)
ndp.Array.random(dice, shape=ndp.Shape([5]), seed=0)
# Array([6, 4, 4, 2, 2], dtype=INT64)

Information

shape: Shape Source

Number of values along each dimension.

Added in version 0.1.0

Examples:

import numdaplot as ndp

ndp.Array.from_list([[1, 2, 3], [4, 5, 6]]).shape
# Shape(dimensions=[2, 3])

dtype: Type Source

Type of the values.

Added in version 0.1.0

Examples:

import numdaplot as ndp

ndp.Array.from_list([1.5, 2.0]).dtype
# <Type.FLOAT64: 10>

Conversion and comparison

to_list() Source

Return the values as a Python list, with one nested list per row for several dimensions.

This is the way to loop over the values: for value in array.to_list().

Added in version 0.1.0

Returns:

  • list[Any]

    Python values, datetime.time for times of day. A missing date, datetime, duration or time of day becomes None, a missing decimal nan.

Examples:

import numdaplot as ndp

ndp.Array.from_list([[1, 2], [3, 4]]).to_list()
# [[1, 2], [3, 4]]

to_value() Source

Return the single value of an Array holding exactly one value, as a Python value.

Added in version 0.1.0

Returns:

  • Any

    The value, None for a missing date, datetime or duration.

Raises:

Examples:

import numdaplot as ndp

ndp.Array.from_list([3, 1, 2]).compute(ndp.Max()).to_value()
# 3

to_numpy() Source

Return a numpy copy of the values; changing it never changes the Array.

Added in version 0.1.0

Returns:

  • numpy.typing.NDArray

    A writable copy of the values. Texts use StringDType with NaN as missing value. Times of day are Python datetime.time objects, None where missing, as numpy has no type for them.

Examples:

import numdaplot as ndp

values = ndp.Array.from_list([1, 2]).to_numpy()
values[0] = 99
values
# array([99,  2])

is_equal(equality) Source

Return whether this Array and another one have the same shape and the same values.

Two missing values at the same position are equal.

Added in version 0.1.0

Parameters:

  • equality (Equality)

    The other Array, and whether the types must also be the same.

Returns:

  • bool

    True when both Arrays are equal.

Raises:

Examples:

import numdaplot as ndp

integers = ndp.Array.from_list([1, 2])
decimals = ndp.Array.from_list([1.0, 2.0])
integers.is_equal(ndp.Equality(other=decimals))
# True

Type change

convert(conversion) Source

Return the values converted to another type, in the same shape, missing values staying missing.

Added in version 0.2.0

Parameters:

  • conversion (ArrayConversion)

    The new type, and the date format or the rule reading numbers as booleans. Accepted: between number types, between numbers and booleans, from numbers, booleans, dates, datetimes, durations and times of day to texts, from texts to numbers, booleans ("true" or "false" in any case), dates, datetimes or times of day, between dates and datetimes, and from datetimes to times of day.

Returns:

  • Self

    A new Array, a copy when the values already have the type.

Raises:

Examples:

import numdaplot as ndp

counts = ndp.Array.from_list([[1, 2], [3, 4]], dtype=ndp.Type.INT8)
counts.convert(ndp.ArrayConversion(dtype=ndp.Type.INT64))
# Array([[1, 2],
#        [3, 4]], dtype=INT64)

Selection

select(rule) Source

Return the values satisfying a rule, in one dimension.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new one-dimensional Array, in reading order.

Raises:

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([[5, 12], [30, 8]])
prices.select(ndp.Greater(10))
# Array([12, 30], dtype=INT64)

check(rule) Source

Return whether each value satisfies a rule, keeping the shape.

Combine several checks with &, | and ~.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new BOOL Array of the same shape.

Raises:

Examples:

import numdaplot as ndp

cities = ndp.Array.from_list(["Paris", "Lyon", "Pau"])
cities.check(ndp.Contains("Pa"))
# Array([ True, False,  True], dtype=BOOL)

take(region) Source

Return the values of a region of a one- or two-dimensional Array.

A row or a column chosen with Index keeps its dimension: one row of a two-dimensional Array is still two-dimensional. Use to_value to read a single value.

Added in version 0.1.0

Parameters:

  • region (Region)

    The rows and the columns to take, every one of a dimension when omitted. Negative positions count from the end.

Returns:

  • Self

    A new Array with as many dimensions as this one.

Raises:

Examples:

import numdaplot as ndp

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

replace(replacement) Source

Return a new Array whose region is replaced; this Array does not change.

Added in version 0.1.0

Parameters:

  • replacement (Replacement)

    The region, and a single value or an Array of exactly the shape of the region.

Returns:

  • Self

    A new Array of the same shape and type.

Raises:

Examples:

import numdaplot as ndp

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

Calculation

compute(statistic, axis=None) Source

Return a statistic of the values, ignoring missing values unless Count or Share is set to include them.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array: one value when axis is omitted, read it with to_value.

Raises:

Warns:

Examples:

import numdaplot as ndp

temperatures = ndp.Array.from_list([12.0, None, 18.0])
temperatures.compute(ndp.Mean()).to_value()
# 15.0

apply(function) Source

Return a math function, a time function or a value mapping applied to each value.

Changed in version 0.2.0

Accepts a ValueMapping keeping the values it does not list, with others=Unmatched.KEEP, and raises ValueConversionError when a ValueMapping gives a number that does not fit the number type of the values. The math functions giving decimals give FLOAT64 for integers of any size. A ValueMapping giving only missing values keeps the type of the values.

Version history (1)

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array of the same shape. Missing values stay missing.

Raises:

Warns:

Examples:

from datetime import date
import numdaplot as ndp

ndp.Array.from_list([1, 4, 9]).apply(ndp.SquareRoot())
# Array([1., 2., 3.], dtype=FLOAT64)
ndp.Array.from_list([date(2026, 3, 14)]).apply(ndp.DatePart(unit=ndp.DatePartUnit.MONTH))
# Array([3.], dtype=FLOAT64)
sexes = ndp.ValueMapping(changes=[ndp.ValueChange(1, "M"), ndp.ValueChange(2, "F")])
ndp.Array.from_list([2, 1]).apply(sexes)
# Array(['F', 'M'], dtype=TEXT)

Layout

reshape(shape) Source

Return the same values arranged in another shape, in reading order.

Added in version 0.1.0

Parameters:

  • shape (Shape)

    The new shape, holding exactly as many values as the Array.

Returns:

  • Self

    A new Array.

Raises:

Examples:

import numdaplot as ndp

ndp.Array.from_list([1, 2, 3, 4, 5, 6]).reshape(ndp.Shape([2, 3]))
# Array([[1, 2, 3],
#        [4, 5, 6]], dtype=INT64)

transpose() Source

Return the Array with its rows turned into columns.

A one-dimensional Array stays the same. With more dimensions, their order is reversed.

Added in version 0.1.0

Returns:

  • Self

    A new Array.

Examples:

import numdaplot as ndp

ndp.Array.from_list([[1, 2, 3], [4, 5, 6]]).transpose()
# Array([[1, 4],
#        [2, 5],
#        [3, 6]], dtype=INT64)

flatten() Source

Return the values in a single dimension, in reading order.

Added in version 0.1.0

Returns:

  • Self

    A new one-dimensional Array.

Examples:

import numdaplot as ndp

ndp.Array.from_list([[1, 2], [3, 4]]).flatten()
# Array([1, 2, 3, 4], dtype=INT64)

sort(sorting=None, axis=None) Source

Return the values sorted inside each row, or inside each column.

Added in version 0.1.0

Parameters:

  • sorting (ArraySorting | None, default: None)

    The order and the place of missing values, the default ArraySorting when omitted.

  • axis (Axis | None, default: None)

    Axis.EACH_ROW sorts the values inside each row, Axis.EACH_COLUMN inside each column. An axis only applies to a two-dimensional Array. When omitted, each row is sorted, which sorts a one-dimensional Array as a whole.

Returns:

  • Self

    A new Array of the same shape.

Raises:

  • InvalidTypeError

    When an argument is not of the type its annotation names.

  • DimensionError

    When an axis is given for an Array that is not two-dimensional.

Examples:

import numdaplot as ndp

ndp.Array.from_list([3.0, None, 1.0]).sort(ndp.ArraySorting(order=ndp.Order.DESCENDING))
# Array([ 3.,  1., nan], dtype=FLOAT64)

unique() Source

Return each distinct value once, sorted, with a single missing value at the end when there is one.

Added in version 0.1.0

Returns:

  • Self

    A new one-dimensional Array.

Examples:

import numdaplot as ndp

ndp.Array.from_list(["b", "a", "b"]).unique()
# Array(['a', 'b'], dtype=TEXT)

Arithmetic operators

__add__(other) Source

Return the sum of each value and another operand, written array + other.

Two Arrays are combined value by value. Two Arrays of different shapes are stretched to match, as in numpy, with a BroadcastWarning. The result follows the numpy type rules.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array.

Warns:

Raises:

  • InvalidTypeError

    When an argument is not of the type its annotation names.

  • ShapeMismatchError

    When the shapes of two Arrays cannot be combined.

  • IncompatibleTypesError

    When the operation does not apply to the types, such as a number and a text.

  • IntegerOverflowError

    When a result does not fit its integer type, which refuses to wrap around to a wrong number.

  • TimeOverflowError

    When a date or a datetime leaves 1677 to 2262, a duration exceeds about 292 years, or a time of day moves past midnight.

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([10, 20])
prices + 5
# Array([15, 25], dtype=INT64)

__sub__(other) Source

Return the difference of each value and another operand, written array - other.

Two Arrays are combined value by value. Two Arrays of different shapes are stretched to match, as in numpy, with a BroadcastWarning. The result follows the numpy type rules.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array.

Warns:

Raises:

  • InvalidTypeError

    When an argument is not of the type its annotation names.

  • ShapeMismatchError

    When the shapes of two Arrays cannot be combined.

  • IncompatibleTypesError

    When the operation does not apply to the types, such as a number and a text.

  • IntegerOverflowError

    When a result does not fit its integer type, which refuses to wrap around to a wrong number.

  • TimeOverflowError

    When a date or a datetime leaves 1677 to 2262, a duration exceeds about 292 years, or a time of day moves past midnight.

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([10, 20])
prices - 5
# Array([ 5, 15], dtype=INT64)

__mul__(other) Source

Return the product of each value and another operand, written array * other.

Two Arrays are combined value by value. Two Arrays of different shapes are stretched to match, as in numpy, with a BroadcastWarning. The result follows the numpy type rules.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array.

Warns:

Raises:

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([10, 20])
prices * 2
# Array([20, 40], dtype=INT64)

__truediv__(other) Source

Return the quotient of each value and another operand, written array / other.

Two Arrays are combined value by value. Two Arrays of different shapes are stretched to match, as in numpy, with a BroadcastWarning. The result follows the numpy type rules.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array.

Warns:

Raises:

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([10, 20])
prices / 4
# Array([2.5, 5. ], dtype=FLOAT64)

__floordiv__(other) Source

Return the whole quotient of each value and another operand, written array // other.

Two Arrays are combined value by value. Two Arrays of different shapes are stretched to match, as in numpy, with a BroadcastWarning. The result follows the numpy type rules.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array.

Warns:

Raises:

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([10, 20])
prices // 3
# Array([3, 6], dtype=INT64)

__mod__(other) Source

Return the remainder of each value and another operand, written array % other.

Two Arrays are combined value by value. Two Arrays of different shapes are stretched to match, as in numpy, with a BroadcastWarning. The result follows the numpy type rules.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array.

Warns:

Raises:

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([10, 20])
prices % 3
# Array([1, 2], dtype=INT64)

__pow__(other) Source

Return the power of each value and another operand, written array ** other.

Two Arrays are combined value by value. Two Arrays of different shapes are stretched to match, as in numpy, with a BroadcastWarning. The result follows the numpy type rules.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array.

Warns:

Raises:

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([10, 20])
prices ** 2
# Array([100, 400], dtype=INT64)

__neg__() Source

Return the opposite of each value, written -array.

Added in version 0.1.0

Returns:

  • Self

    A new Array.

Raises:

Examples:

import numdaplot as ndp

-ndp.Array.from_list([1, -2])
# Array([-1,  2], dtype=INT64)

Arithmetic operators with a value on the left

__radd__(other) Source

Return the sum of a single value and each value, written value + array.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array.

Warns:

Raises:

  • InvalidTypeError

    When an argument is not of the type its annotation names.

  • IncompatibleTypesError

    When the operation does not apply to the types, such as a number and a text.

  • IntegerOverflowError

    When a result does not fit its integer type, which refuses to wrap around to a wrong number.

  • TimeOverflowError

    When a date or a datetime leaves 1677 to 2262, a duration exceeds about 292 years, or a time of day moves past midnight.

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([10, 20])
5 + prices
# Array([15, 25], dtype=INT64)

__rsub__(other) Source

Return the difference of a single value and each value, written value - array.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array.

Warns:

Raises:

  • InvalidTypeError

    When an argument is not of the type its annotation names.

  • IncompatibleTypesError

    When the operation does not apply to the types, such as a number and a text.

  • IntegerOverflowError

    When a result does not fit its integer type, which refuses to wrap around to a wrong number.

  • TimeOverflowError

    When a date or a datetime leaves 1677 to 2262, a duration exceeds about 292 years, or a time of day moves past midnight.

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([10, 20])
100 - prices
# Array([90, 80], dtype=INT64)

__rmul__(other) Source

Return the product of a single value and each value, written value * array.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array.

Warns:

Raises:

  • InvalidTypeError

    When an argument is not of the type its annotation names.

  • IncompatibleTypesError

    When the operation does not apply to the types, such as a number and a text.

  • IntegerOverflowError

    When a result does not fit its integer type, which refuses to wrap around to a wrong number.

  • TimeOverflowError

    When a date or a datetime leaves 1677 to 2262, or a duration exceeds about 292 years.

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([10, 20])
2 * prices
# Array([20, 40], dtype=INT64)

__rtruediv__(other) Source

Return the quotient of a single value and each value, written value / array.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array.

Warns:

Raises:

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([10, 20])
100 / prices
# Array([10.,  5.], dtype=FLOAT64)

__rfloordiv__(other) Source

Return the whole quotient of a single value and each value, written value // array.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array.

Warns:

Raises:

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([10, 20])
100 // prices
# Array([10,  5], dtype=INT64)

__rmod__(other) Source

Return the remainder of a single value and each value, written value % array.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array.

Warns:

Raises:

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([10, 20])
25 % prices
# Array([5, 5], dtype=INT64)

__rpow__(other) Source

Return the power of a single value and each value, written value ** array.

Added in version 0.1.0

Parameters:

Returns:

  • Self

    A new Array.

Warns:

Raises:

Examples:

import numdaplot as ndp

prices = ndp.Array.from_list([10, 20])
2 ** prices
# Array([   1024, 1048576], dtype=INT64)

Logical operators

__and__(other) Source

Return True where both operands are True, written array & other.

Added in version 0.1.0

Parameters:

  • other (Self | bool)

    A BOOL Array or a boolean.

Returns:

  • Self

    A new BOOL Array.

Raises:

Examples:

import numdaplot as ndp

ages = ndp.Array.from_list([15, 30, 70])
ages.check(ndp.Greater(18)) & ages.check(ndp.Less(65))
# Array([False,  True, False], dtype=BOOL)

__rand__(other) Source

Return True where both operands are True, written value & array.

Added in version 0.1.0

Parameters:

  • other (bool)

    A boolean.

Returns:

  • Self

    A new BOOL Array.

Raises:

Examples:

import numdaplot as ndp

True & ndp.Array.from_list([True, False])
# Array([ True, False], dtype=BOOL)

__or__(other) Source

Return True where at least one operand is True, written array | other.

Added in version 0.1.0

Parameters:

  • other (Self | bool)

    A BOOL Array or a boolean.

Returns:

  • Self

    A new BOOL Array.

Raises:

Examples:

import numdaplot as ndp

ages = ndp.Array.from_list([15, 30, 70])
ages.check(ndp.Less(18)) | ages.check(ndp.Greater(65))
# Array([ True, False,  True], dtype=BOOL)

__ror__(other) Source

Return True where at least one operand is True, written value | array.

Added in version 0.1.0

Parameters:

  • other (bool)

    A boolean.

Returns:

  • Self

    A new BOOL Array.

Raises:

Examples:

import numdaplot as ndp

False | ndp.Array.from_list([True, False])
# Array([ True, False], dtype=BOOL)

__invert__() Source

Return True where the value is False, and False where it is True, written ~array.

Added in version 0.1.0

Returns:

  • Self

    A new BOOL Array.

Raises:

Examples:

import numdaplot as ndp

~ndp.Array.from_list([True, False])
# Array([False,  True], dtype=BOOL)

Display

__repr__() Source

Return the text of the Array: its values, then its type.

Added in version 0.1.0

Returns:

Examples:

import numdaplot as ndp

ndp.Array.from_list(["a", "b"])
# Array(['a', 'b'], dtype=TEXT)

Refused operations

__eq__(other) Source

Refuse array == other; use is_equal or check(ndp.Equal(...)).

Added in version 0.1.0

Parameters:

  • other (object)

    Any value.

Raises:

__ne__(other) Source

Refuse array != other; use is_equal or check(ndp.NotEqual(...)).

Added in version 0.1.0

Parameters:

  • other (object)

    Any value.

Raises:

__lt__(other) Source

Refuse array < other; use select or check with ndp.Less.

Added in version 0.1.0

Parameters:

  • other (object)

    Any value.

Raises:

Examples:

import numdaplot as ndp

try:
    ndp.Array.from_list([1, 2]) < 2
except ndp.RefusedOperationError as error:
    print(error)
# Comparing an Array with < is not available, use select or check with a rule such as ndp.Less instead.

__le__(other) Source

Refuse array <= other; use select or check with ndp.LessOrEqual.

Added in version 0.1.0

Parameters:

  • other (object)

    Any value.

Raises:

__gt__(other) Source

Refuse array > other; use select or check with ndp.Greater.

Added in version 0.1.0

Parameters:

  • other (object)

    Any value.

Raises:

__ge__(other) Source

Refuse array >= other; use select or check with ndp.GreaterOrEqual.

Added in version 0.1.0

Parameters:

  • other (object)

    Any value.

Raises:

__getitem__(key) Source

Refuse array[...]; use take, select or check.

Added in version 0.1.0

Parameters:

  • key (object)

    Any value.

Raises:

__setitem__(key, value) Source

Refuse array[...] = value; use replace, which returns a new Array.

Added in version 0.1.0

Parameters:

  • key (object)

    Any value.

  • value (object)

    Any value.

Raises:

__iter__() Source

Refuse for value in array; iterate over array.to_list() instead.

Added in version 0.1.0

Raises:

Examples:

import numdaplot as ndp

for price in ndp.Array.from_list([10, 20]).to_list():
    print(price)
# 10
# 20

__contains__(value) Source

Refuse value in array; use check with ndp.Equal or ndp.IsIn.

Added in version 0.1.0

Parameters:

  • value (object)

    Any value.

Raises:

__len__() Source

Refuse len(array); read the shape attribute instead.

Added in version 0.1.0

Raises:

__bool__() Source

Refuse if array: and bool(array), whose meaning would be unclear.

Added in version 0.1.0

Raises:

__matmul__(other) Source

Refuse array @ other; numdaplot has no linear algebra.

Added in version 0.1.0

Parameters:

  • other (object)

    Any value.

Raises:

__rmatmul__(other) Source

Refuse other @ array; numdaplot has no linear algebra.

Added in version 0.1.0

Parameters:

  • other (object)

    Any value.

Raises: