preprocessing.curate_data.basic_ts_checks(data, verbose=False)
Checks if the time series data has a datetime index and is sorted.
Parameters
| data |
pd.DataFrame |
The main dataset. |
required |
| verbose |
bool |
Whether to print additional information. |
False |
Examples
import pandas as pd
from spotforecast2_safe.preprocessing.curate_data import basic_ts_checks
date_rng = pd.date_range(start="2023-01-01", periods=5, freq="h", tz="UTC")
data = pd.DataFrame({"value": range(5)}, index=date_rng)
result = basic_ts_checks(data, verbose=True)
assert result is True
The time series data has a valid datetime index that is sorted and complete.
Raises
|
TypeError |
If the index is not a datetime index. |
|
ValueError |
If the datetime index is not sorted in increasing order or is incomplete. |
Returns
| bool |
bool |
True if the datetime index is valid, sorted, and complete. |