id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 712217045,MDU6SXNzdWU3MTIyMTcwNDU=,4476,Reimplement GroupBy.argmax,1200058,open,0,,,5,2020-09-30T19:25:22Z,2023-03-03T06:59:40Z,,NONE,,,,"Please implement **Is your feature request related to a problem? Please describe.** Observed: ```python da.groupby(""g"").argmax(dim=""t"") ``` ```python --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) in ----> 1 da.groupby(""g"").argmax(dim=""t"") AttributeError: 'DataArrayGroupBy' object has no attribute 'argmax' ``` **Describe the solution you'd like** Expected: Vector of length `len(unique(g))` containing the indices of `da[""t""]` where the value was maximum. **Workaround:** ```python da.groupby(""g"").apply(lambda c: c.argmax(dim=""t"")) ``` ``` array([[ 7], [ 0], [14], [14], [ 0], [ 0], [ 7], [ 0], [14], [ 0], [ 7]]) Coordinates: * st (st) object 'a' ... 'z' * g (g) object 'E' ``` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4476/reactions"", ""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 528060435,MDU6SXNzdWU1MjgwNjA0MzU=,3570,fillna on dataset converts all variables to float,1200058,open,0,,,5,2019-11-25T12:39:49Z,2020-09-15T15:35:04Z,,NONE,,,,"#### MCVE Code Sample ```python xr.Dataset( { ""A"": (""x"", [np.nan, 2, np.nan, 0]), ""B"": (""x"", [3, 4, np.nan, 1]), ""C"": (""x"", [True, True, False, False]), ""D"": (""x"", [np.nan, 3, np.nan, 4]) }, coords={""x"": [0, 1, 2, 3]} ).fillna(value={""A"": 0}) ``` ``` Dimensions: (x: 4) Coordinates: * x (x) int64 0 1 2 3 Data variables: A (x) float64 0.0 2.0 0.0 0.0 B (x) float64 3.0 4.0 nan 1.0 C (x) float64 1.0 1.0 0.0 0.0 D (x) float64 nan 3.0 nan 4.0 ``` #### Expected Output ``` Dimensions: (x: 4) Coordinates: * x (x) int64 0 1 2 3 Data variables: A (x) float64 0.0 2.0 0.0 0.0 B (x) float64 3.0 4.0 nan 1.0 C (x) bool True True False False D (x) float64 nan 3.0 nan 4.0 ``` #### Problem Description I'd like to use `fillna` to replace NaN's in some of a `Dataset`'s variables. However, `fillna` unexpectably converts all variables to float, even if they are boolean or integers. Would it be possible to apply `fillna` only on float / object types and consider the `value` argument, if I only want to apply `fillna` to a subset of the dataset? #### Output of ``xr.show_versions()``
INSTALLED VERSIONS ------------------ commit: None python: 3.7.4 (default, Aug 13 2019, 20:35:49) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 3.10.0-957.27.2.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.4 libnetcdf: 4.6.1 xarray: 0.14.0 pandas: 0.25.1 numpy: 1.17.2 scipy: 1.3.1 netCDF4: 1.4.2 pydap: None h5netcdf: 0.7.4 h5py: 2.9.0 Nio: None zarr: 2.3.2 cftime: 1.0.3.4 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.5.2 distributed: 2.5.2 matplotlib: 3.1.1 cartopy: None seaborn: 0.9.0 numbagg: None setuptools: 41.4.0 pip: 19.2.3 conda: None pytest: 5.0.1 IPython: 7.8.0 sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3570/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue