-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Dataset.apply allows passing positional arguments to func as args=(), whereas DataArrayGroupBy.apply and DatasetGroupBy.apply do not. The documentation also incorrectly suggests that the reverse is true:
Dataset.apply:
Lines 2832 to 2840 in 4de8dbc
| def apply(self, func, keep_attrs=False, args=(), **kwargs): | |
| """Apply a function over the data variables in this dataset. | |
| Parameters | |
| ---------- | |
| func : function | |
| Function which can be called in the form `f(x, **kwargs)` to | |
| transform each DataArray `x` in this dataset into another | |
| DataArray. |
DataArrayGroupBy.apply:
Lines 473 to 478 in 4de8dbc
| def apply(self, func, shortcut=False, **kwargs): | |
| """Apply a function over each array in the group and concatenate them | |
| together into a new array. | |
| `func` is called like `func(ar, *args, **kwargs)` for each array `ar` | |
| in this group. |
DatasetGroupBy.apply:
Lines 580 to 585 in 4de8dbc
| def apply(self, func, **kwargs): | |
| """Apply a function over each Dataset in the group and concatenate them | |
| together into a new Dataset. | |
| `func` is called like `func(ds, *args, **kwargs)` for each dataset `ds` | |
| in this group. |
I feel that funcs passed to GroupBy objects are generally equally deserving of positional arguments, and I don't see a reason why this isn't the case.
Metadata
Metadata
Assignees
Labels
No labels