DimensionError(operation, dimension_count)
Source¶
Bases: NumdaplotError
Raised when an operation does not apply to the number of dimensions of an Array.
For example, an axis only applies to a two-dimensional Array, and a one-dimensional Array has no columns.
Added in version 0.1.0
Parameters:
-
operation(str)Description of the rejected operation.
-
dimension_count(int)Number of dimensions of the Array.
Attributes:
-
operationDescription of the rejected operation.
-
dimension_countNumber of dimensions of the Array.
Examples:
import numdaplot as ndp
array = ndp.Array.from_list([1, 2, 3])
try:
array.compute(ndp.Sum(), axis=ndp.Axis.EACH_ROW)
except ndp.DimensionError as error:
print(error)
# An axis does not apply to an Array of 1 dimension(s).