darts icon indicating copy to clipboard operation
darts copied to clipboard

[BUG]Business Hourly Reporting

Open colin99d opened this issue 3 years ago • 1 comments

Describe the bug Using business hours fails when there are gaps in the data. Even when the hours are within "business hours". Screen Shot 2022-07-04 at 9 34 46 AM Another interesting component of this issue is that the errors say that interval with freq="h" could not be filled, even though I set a freq of "BH". Below is the code to get the series (just to show that freq="BH"), and then the error.

def get_series(data, target_col: str = None, is_scaler: bool = True):
    filler = MissingValuesFiller()
    filler_kwargs = dict(
        df=data,
        time_col="date",
        value_cols=[target_col],
        freq="BH",
        fill_missing_dates=True,
    )
    try:
        ticker_series = TimeSeries.from_dataframe(**filler_kwargs)
    except ValueError:
        # remove business days to allow base lib to assume freq
        filler_kwargs.pop("freq")
        ticker_series = TimeSeries.from_dataframe(**filler_kwargs)
Screen Shot 2022-07-04 at 9 41 35 AM

To Reproduce Try creating a timeseries with the below data: 1hour.csv

Expected behavior I would expect the BH frequency to be detected and for that to be used.

System (please complete the following information):

  • Python version: 3.9.13
  • darts version: 0.20.0

colin99d avatar Jul 04 '22 13:07 colin99d

Hi, I think this might be due to your DF not having evenly spaced timestamps - see for instance the difference between the last time stamp and the one before is 30 minutes: image

You seem to have quite a few different time deltas in there: image

Providing a data frame with hourly data would probably help and I hope solve the issue.

hrzn avatar Jul 07 '22 12:07 hrzn

Closing for now. Pls re-open if needed @colin99d

hrzn avatar Aug 23 '22 09:08 hrzn