ibm-granite / granite-tsfm

Foundation Models for Time Series
Apache License 2.0
419 stars 184 forks source link

index error when there are fewer than 2 rows in a group dataframe #128

Open chandrakreddy opened 2 months ago

chandrakreddy commented 2 months ago

tsfm_public/toolkit/dataset.py:879 will have an index error if there are fewer than 2 rows in the input dataframe in case of timestamp_column not being None. in this case, simply return the data frame.

wgifford commented 2 months ago

@chandrakreddy if there are fewer than two rows in the input dataframe (or any split of the dataframe), I am seeing the error here:

tsfm_public/toolkit/dataset.py:870: in ts_padding
    period = df.iloc[1][timestamp_column] - df.iloc[0][timestamp_column]

Period of the data cannot be estimated without two or more samples. In this case, we fill timestamp column with None -- resulting dataset will have NaT as the timestamp. If you have ideas of a different strategy, please let me know.