# xarray.core.groupby.DatasetGroupBy.map

#### DatasetGroupBy.map(func, args=(), shortcut=None, \*\*kwargs)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/groupby.py#L1875-L1914)

Apply a function to 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.

Apply uses heuristics (like pandas.GroupBy.apply) to figure out how
to stack together the datasets. The rule is:

1. If the dimension along which the group coordinate is defined is
   still in the first grouped item after applying func, then stack
   over this dimension.
2. Otherwise, stack over the new dimension given by name of this
   grouping (the argument to the groupby function).

* **Parameters:**
  * **func** ([`callable()`](https://docs.python.org/3/builtins/functions.html#callable)) – Callable to apply to each sub-dataset.
  * **args** ([`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple), *optional*) – Positional arguments to pass to func.
  * **\*\*kwargs** – Used to call func(ds, \*\*kwargs) for each sub-dataset ar.
* **Returns:**
  **applied** ([`Dataset`](xarray.Dataset.html.md#xarray.Dataset)) – The result of splitting, applying and combining this dataset.
