Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warn user if suspicion of wrong index in from_group_dataframe() #1628

Merged
merged 5 commits into from
Mar 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions darts/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,10 @@ def from_group_dataframe(
timestamps) or a RangeIndex (if it contains integers).
If not set, the DataFrame index will be used. In this case the DataFrame must contain an index that is
either a pandas DatetimeIndex, a pandas RangeIndex, or a pandas Index that can be converted to a
RangeIndex. It is better if the index has no holes; alternatively setting `fill_missing_dates` can in some
cases solve these issues (filling holes with NaN, or with the provided `fillna_value` numeric value, if
any).
RangeIndex. Be aware that the index must represents the actual index of each individual time series group
(can contain non-unique values). It is better if the index has no holes; alternatively setting
`fill_missing_dates` can in some cases solve these issues (filling holes with NaN, or with the provided
`fillna_value` numeric value, if any).
value_cols
A string or list of strings representing the value column(s) to be extracted from the DataFrame. If set to
`None`, the whole DataFrame will be used.
Expand Down Expand Up @@ -775,6 +776,13 @@ def from_group_dataframe(
List[TimeSeries]
A list containing a univariate or multivariate deterministic TimeSeries per group in the DataFrame.
"""
if time_col is None and df.index.is_monotonic_increasing:
logger.warning(
"UserWarning: `time_col` was not set and `df` has a monotonically increasing (time) index. This "
"results in time series groups with non-overlapping (time) index. You can ignore this warning if the "
"index represents the actual index of each individual time series group."
)

group_cols = [group_cols] if not isinstance(group_cols, list) else group_cols
if static_cols is not None:
static_cols = (
Expand Down