gcages.typing#
Type hints that are used throughout
Attributes:
| Name | Type | Description |
|---|---|---|
NP_ARRAY_OF_FLOAT_OR_INT |
TypeAlias
|
Type alias for an array of numpy float or int (not complex) |
NP_FLOAT_OR_INT |
TypeAlias
|
Type alias for a numpy float or int (not complex) |
NUMERIC_DATA |
TypeAlias
|
Type alias for a value that can be used in the data of a TimeseriesDataFrame |
PINT_SCALAR |
TypeAlias
|
Type alias for a pint quantity that wraps a numpy scalar |
TIME_POINT |
TypeAlias
|
Type alias for a value that can be used in the columns of a TimeseriesDataFrame |
TimeseriesDataFrame |
TypeAlias
|
Type alias for the pd.DataFrame shape we use throughout |
NP_ARRAY_OF_FLOAT_OR_INT
module-attribute
#
NP_ARRAY_OF_FLOAT_OR_INT: TypeAlias = NDArray[
NP_FLOAT_OR_INT
]
Type alias for an array of numpy float or int (not complex)
NP_FLOAT_OR_INT
module-attribute
#
Type alias for a numpy float or int (not complex)
NUMERIC_DATA
module-attribute
#
NUMERIC_DATA: TypeAlias = Union[float, int, NP_FLOAT_OR_INT]
Type alias for a value that can be used in the data of a TimeseriesDataFrame
PINT_SCALAR
module-attribute
#
PINT_SCALAR: TypeAlias = NumpyQuantity[NP_FLOAT_OR_INT]
Type alias for a pint quantity that wraps a numpy scalar
TIME_POINT
module-attribute
#
Type alias for a value that can be used in the columns of a TimeseriesDataFrame
TimeseriesDataFrame
module-attribute
#
TimeseriesDataFrame: TypeAlias = DataFrame
Type alias for the pd.DataFrame shape we use throughout
For typing purposes, this is just a direct alias of pd.DataFrame. However, the point of defining this is to provide greater clarity of the kind of data we expect.
We expect a collection of timeseries. These timeseries are defined by the columns, which we expect to be timepoints. We expect that the index contains metadata about each timeseries. As a result, the data itself should be numerical only (no strings, no lists, no dicts).
An example of this kind of data is given below. Note, in line with the description above:
- Data is in the body of the pd.DataFrame
- The columns define the time axis
- All metadata is contained in the index