You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that the package is currently incompatible with pandas=1.1.3.
Using gluonts latest with pandas 1.1.3. When running the ListDataset command, we get the following bug, which happens in the _as_period function ( https://github.com/awslabs/gluonts/blob/v0.16.x/src/gluonts/dataset/common.py#L262 ). It would appear that in the version of pandas, the frequency pandas._libs.tslibs.offsets.Hour is not hashable, which is incompatible with the use of the cache (@lru_cache used with _as_period).
Upgrading to pandas=1.4.1 resolves the issue.
To Reproduce
Reproduced the hashable error locally using different pandas version. The following code succeeds with pandas 1.4.1, but fails with pandas 1.1.3
from pandas.tseries.frequencies import to_offset
from functools import lru_cache
# Copy / pasting the `_as_period` function
@lru_cache(maxsize=10_000)
def _as_period(val, freq):
return pd.Period(val, freq)
data = dict()
data["start"] = "2022-01-16 00:00:00"
data["start"] = _as_period(data["start"], to_offset("H"))
Error message or code output
[CPython39-test] def __call__(self, data: DataEntry) -> DataEntry:
[CPython39-test] try:
[CPython39-test] if self.use_timestamp:
[CPython39-test] data[self.name] = pd.Timestamp(data[self.name])
[CPython39-test] else:
[CPython39-test] data[self.name] = _as_period(data[self.name], self.freq)
[CPython39-test] except (TypeError, ValueError) as e:
[CPython39-test] > raise GluonTSDataError(
[CPython39-test] f'Error "{e}" occurred, when reading field "{self.name}" with data "{data[self.name]}" and freq "{self.freq}"'
[CPython39-test] ) from e
[CPython39-test] E gluonts.exceptions.GluonTSDataError: Error "unhashable type: 'pandas._libs.tslibs.offsets.Hour'" occurred, when reading field "start" with data "2022-01-16 00:00:00" and freq "<Hour>"
Environment
Operating system:
Python version: 3.9
GluonTS version: 0.16
MXNet version:
(Add as much information about your environment as possible, e.g. dependencies versions.)
The text was updated successfully, but these errors were encountered:
@VictorJouault thanks for spotting this. Unfortunately I think it's very hard to maintain backward-compatibility with very old versions of Pandas, due to the many breaking changes here and there.
In my opinion, the fix here is to upgrade the minimum version for pandas to 1.4.1 (is that the earliest version that works?). What do you think?
Description
It appears that the package is currently incompatible with pandas=1.1.3.
Using gluonts latest with pandas 1.1.3. When running the
ListDataset
command, we get the following bug, which happens in the_as_period
function ( https://github.com/awslabs/gluonts/blob/v0.16.x/src/gluonts/dataset/common.py#L262 ). It would appear that in the version of pandas, the frequencypandas._libs.tslibs.offsets.Hour
is not hashable, which is incompatible with the use of the cache (@lru_cache
used with_as_period
).Upgrading to pandas=1.4.1 resolves the issue.
To Reproduce
Reproduced the hashable error locally using different pandas version. The following code succeeds with pandas 1.4.1, but fails with pandas 1.1.3
Error message or code output
Environment
(Add as much information about your environment as possible, e.g. dependencies versions.)
The text was updated successfully, but these errors were encountered: