From 0163d2cb4f5770dbdc163542efa619f8cace6f4b Mon Sep 17 00:00:00 2001 From: Fabian Date: Wed, 7 Aug 2024 10:26:19 +0200 Subject: [PATCH] linexpression: drop squeeze argument in groupby --- linopy/expressions.py | 7 +------ linopy/variables.py | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/linopy/expressions.py b/linopy/expressions.py index 397cd2b3..0ad210a3 100644 --- a/linopy/expressions.py +++ b/linopy/expressions.py @@ -1212,7 +1212,6 @@ def diff(self, dim: str, n: int = 1) -> LinearExpression: def groupby( self, group: DataFrame | Series | DataArray, - squeeze: bool = True, restore_coord_dims: bool | None = None, **kwargs, ) -> LinearExpressionGroupby: @@ -1227,10 +1226,6 @@ def groupby( group : str, DataArray or IndexVariable Array whose unique values should be used to group this array. If a string, must be the name of a variable contained in this dataset. - squeeze : bool, optional - If "group" is a dimension of any arrays in this dataset, `squeeze` - controls whether the subarrays have a dimension of length 1 along - that dimension or if the dimension is squeezed out. restore_coord_dims : bool, optional If True, also restore the dimension order of multi-dimensional coordinates. @@ -1242,7 +1237,7 @@ def groupby( the correct return type. """ ds = self.data - kwargs = dict(squeeze=squeeze, restore_coord_dims=restore_coord_dims, **kwargs) + kwargs = dict(restore_coord_dims=restore_coord_dims, **kwargs) return LinearExpressionGroupby(ds, group, model=self.model, kwargs=kwargs) def rolling( diff --git a/linopy/variables.py b/linopy/variables.py index 1008c543..c589d3a0 100644 --- a/linopy/variables.py +++ b/linopy/variables.py @@ -516,7 +516,6 @@ def dot(self, other: ndarray | Variable) -> QuadraticExpression | LinearExpressi def groupby( self, group: DataArray, - squeeze: bool = True, restore_coord_dims: bool | None = None, ) -> LinearExpressionGroupby: """ @@ -530,10 +529,6 @@ def groupby( group : str, DataArray or IndexVariable Array whose unique values should be used to group this array. If a string, must be the name of a variable contained in this dataset. - squeeze : bool, optional - If "group" is a dimension of any arrays in this dataset, `squeeze` - controls whether the subarrays have a dimension of length 1 along - that dimension or if the dimension is squeezed out. restore_coord_dims : bool, optional If True, also restore the dimension order of multi-dimensional coordinates. @@ -545,7 +540,7 @@ def groupby( the correct return type. """ return self.to_linexpr().groupby( - group=group, squeeze=squeeze, restore_coord_dims=restore_coord_dims + group=group, restore_coord_dims=restore_coord_dims ) def rolling(