TimeSeriesIndex class

Represents a time series index with timestamps and frequency information.

This class provides functionality similar to pandas' DatetimeIndex, allowing for time-based indexing and operations on time series data.

Constructors

TimeSeriesIndex(List<DateTime> _timestamps, {String? frequency, String? name})
Creates a TimeSeriesIndex with the given timestamps and optional frequency.
TimeSeriesIndex.dateRange({required DateTime start, DateTime? end, int? periods, String frequency = 'D', String? name})
Creates a TimeSeriesIndex from a date range.
factory

Properties

first DateTime
The first timestamp in this index
no setter
frequency String?
The frequency of this index
no setter
hashCode int
The hash code for this object.
no setteroverride
isEmpty bool
Whether this index is empty
no setter
isNotEmpty bool
Whether this index is not empty
no setter
last DateTime
The last timestamp in this index
no setter
length int
The number of timestamps in this index
no setter
name String?
The name of this index
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timestamps List<DateTime>
The timestamps in this index
no setter

Methods

asFreq(String newFrequency, {String method = 'nearest'}) TimeSeriesIndex
Converts this TimeSeriesIndex to a different frequency.
contains(DateTime timestamp) bool
Checks if this index contains the given timestamp
detectFrequency() String?
Detects the frequency of the time series based on the timestamps.
indexOf(DateTime timestamp) int
Finds the index of the given timestamp
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
slice(DateTime start, DateTime end) TimeSeriesIndex
Returns a subset of this index between start and end dates
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override
operator [](int index) DateTime
Access timestamp by index