incline.TimeAxis¶
- class incline.TimeAxis(x, delta, unit)[source]¶
Numeric time positions for a series.
- Variables:
x (numpy._typing._array_like.NDArray[numpy.float64]) – Strictly increasing positions. Days from the start for a
DatetimeIndex, otherwise the index values themselves.delta (float) – Median spacing between consecutive positions. Derivatives are reported per unit of
x, so this is the scale factor between “per observation” and “per unit time”.unit (str) –
'days'when derived from datetimes, else'index'.
- Parameters:
- __init__(x, delta, unit)¶
Methods
__init__(x, delta, unit)from_frame(df[, time_column])Build an axis from a DataFrame, preferring an explicit time column.
from_index(index)Build an axis from a pandas index.
key()A hashable identity for this axis.
positional(n)Build a unit-spaced axis of length
n.require_regular(method)Warn when a grid-based method is used on irregular sampling.
Attributes
Whether the sampling is uniform enough for grid-based methods.
Number of observations.
Coefficient of variation of the spacing.
Distance from the first to the last observation.
- x: NDArray[float64]¶
- classmethod from_index(index)[source]¶
Build an axis from a pandas index.
- Parameters:
index (pd.Index) – A
DatetimeIndexorPeriodIndex(converted to days from the start) or any numeric index.- Returns:
The corresponding TimeAxis.
- Raises:
ValueError – If the index carries no time information.
- Return type:
Self
- classmethod from_frame(df, time_column=None)[source]¶
Build an axis from a DataFrame, preferring an explicit time column.
- Parameters:
df (pd.DataFrame) – The series being estimated.
time_column (str | None) – Numeric time column. When None the index is used.
- Returns:
The corresponding TimeAxis.
- Return type:
Self
- classmethod positional(n)[source]¶
Build a unit-spaced axis of length
n.- Parameters:
n (int) – Number of observations.
- Returns:
A TimeAxis over
0, 1, ..., n-1.- Return type:
Self