Skip to content

Commit 544598d

Browse files
shchurlostella
authored andcommitted
Set observed=True inside DataFrame.groupby in PandasDataset to silence the FutureWarning (#3254)
*Issue #, if available:* *Description of changes:* - Set `observed=True` inside `DataFrame.groupby` in `PandasDataset` to silence the FutureWarning. Relevant pandas documentation: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.groupby.html#pandas-dataframe-groupby. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. **Please tag this pr with at least one of these labels to make our release process faster:** BREAKING, new feature, bug fix, other change, dev setup
1 parent 838572d commit 544598d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/gluonts/dataset/pandas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def from_long_dataframe(
305305
other_static_features = pd.DataFrame()
306306

307307
logger.info(f"Grouping data by '{item_id}'; this may take some time.")
308-
pairs = list(dataframe.groupby(item_id))
308+
pairs = list(dataframe.groupby(item_id, observed=True))
309309

310310
return cls(
311311
dataframes=pairs,

0 commit comments

Comments
 (0)