AxisIndex class
Axis index for N-dimensional arrays
Provides labeled access to array dimensions, similar to pandas Index. Used by NDArray and DataCube to label axes.
Example:
var index = AxisIndex(['2024-01-01', '2024-01-02', '2024-01-03']);
print(index.getPosition('2024-01-02')); // 1
print(index.getLabel(1)); // '2024-01-02'
Constructors
- AxisIndex(List labels, {String? name})
- Create an axis index from labels
- AxisIndex.dateRange({required DateTime start, required DateTime end, Duration step = const Duration(days: 1), String? name})
-
Create an index from a DateTime range
factory
- AxisIndex.range(int length, {int start = 0, String? name})
-
Create an integer range index
factory
Properties
- dtype → Type
-
Get the data type of labels
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- isDateTime → bool
-
Check if labels are DateTime
no setter
- isEmpty → bool
-
Check if index is empty
no setter
- isMonotonicDecreasing → bool
-
Check if labels are monotonic decreasing
no setter
- isMonotonicIncreasing → bool
-
Check if labels are monotonic increasing
no setter
- isNotEmpty → bool
-
Check if index is not empty
no setter
- isNumeric → bool
-
Check if labels are numeric
no setter
- isUnique → bool
-
Check if all labels are unique (always true for AxisIndex)
no setter
- labels → List
-
The labels for this axis
final
- length → int
-
Length of this index
no setter
- name → String?
-
Name of this axis (optional)
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
contains(
dynamic label) → bool - Check if a label exists in this index
-
getLabel(
int position) → dynamic - Get label at a position
-
getLabels(
List< int> positions) → List - Get labels at multiple positions
-
getPosition(
dynamic label) → int? - Get position (integer index) for a label
-
getPositions(
List labelList) → List< int?> - Get positions for multiple labels
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
slice(
List< int> positions) → AxisIndex - Create a new index with a subset of labels
-
toList(
) → List - Convert to list
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override