html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/pull/2375#issuecomment-415647225,https://api.github.com/repos/pydata/xarray/issues/2375,415647225,MDEyOklzc3VlQ29tbWVudDQxNTY0NzIyNQ==,1217238,2018-08-24T04:24:33Z,2018-08-24T04:24:33Z,MEMBER,"It might make sense to use a list instead of a set here.
On Thu, Aug 23, 2018 at 8:37 PM Keisuke Fujii
wrote:
> *@fujiisoup* commented on this pull request.
>
> Thanks. A few comments.
> ------------------------------
>
> In xarray/core/dataset.py
> :
>
> > +
> + missing_dims = [dim for dim in dims if dim not in self.dims]
> + if missing_dims:
> + raise ValueError('Dataset does not contain the dimensions: %s'
> + % missing_dims)
> +
> + non_multi_dims = [dim for dim in dims
> + if not isinstance(self.get_index(dim), pd.MultiIndex)]
> + if non_multi_dims and dim_from_kwarg:
> + raise ValueError('cannot unstack dimensions that do not '
> + 'have a MultiIndex: %s' % non_multi_dims)
> +
> + dims = dims - set(non_multi_dims)
> + if len(dims) == 0:
> + raise ValueError('cannot unstack an object that does not have '
> + 'MultiIndex dimensions')
>
> I think that we can allow to unstack an object without MultiIndex, which
> just returns as is.
> It would be useful if users want to remove any MultiIndexes from an object.
> ------------------------------
>
> In xarray/core/dataset.py
> :
>
> > + -------
> + unstacked : Dataset
> + Dataset with unstacked data.
> +
> + See also
> + --------
> + Dataset.stack
> + """"""
> + dim_from_kwarg = dim is not None
> +
> + if isinstance(dim, basestring):
> + dims = set([dim])
> + elif dim is None:
> + dims = set(self.dims)
> + else:
> + dims = set(dim)
>
> Maybe we can use OrderedSet instead of set so that the resultant
> dimension order is fixed.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> ,
> or mute the thread
>
> .
>
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,352677925
https://github.com/pydata/xarray/pull/2375#issuecomment-415492951,https://api.github.com/repos/pydata/xarray/issues/2375,415492951,MDEyOklzc3VlQ29tbWVudDQxNTQ5Mjk1MQ==,1217238,2018-08-23T17:01:23Z,2018-08-23T17:01:23Z,MEMBER,"Dataset.transpose accepts *args based on the design of
numpy.ndarray.transpose, but that API is probably a mistake (both in NumPy
and xarray). Everything else uses an axis/dim argument that can take a
scalar or sequence value.
On Thu, Aug 23, 2018 at 9:56 AM Julia Signell
wrote:
> I can change it. I guess I was looking at Dataset.transpose:
> https://github.com/pydata/xarray/blob/master/xarray/core/dataset.py#L2498
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> , or mute
> the thread
>
> .
>
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,352677925
https://github.com/pydata/xarray/pull/2375#issuecomment-415486919,https://api.github.com/repos/pydata/xarray/issues/2375,415486919,MDEyOklzc3VlQ29tbWVudDQxNTQ4NjkxOQ==,1217238,2018-08-23T16:46:41Z,2018-08-23T16:46:41Z,MEMBER,"> I chose to use *dims rather than a list of dims so that this change will have a very small impact on people. Most people probably do something like unstack('z') right now, and that will still work.
Usually we prefer to stick to a single argument, but use isinstance checks to support both single dimensions and lists of dimensions, e.g., see how `dim` is parsed in `Dataset.reduce`:
https://github.com/pydata/xarray/blob/master/xarray/core/dataset.py#L2774-L2779","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,352677925
https://github.com/pydata/xarray/pull/2375#issuecomment-415227870,https://api.github.com/repos/pydata/xarray/issues/2375,415227870,MDEyOklzc3VlQ29tbWVudDQxNTIyNzg3MA==,1217238,2018-08-23T00:06:56Z,2018-08-23T00:06:56Z,MEMBER,"I think `unstack()` unstacking all dimensions by default would make sense.
> Should we be using xr.full_like in this way?
I'm not really opposed to `full_like` working this way, but it does look a little strange to my eye. The ""full"" part of the name doesn't really make sense to me. I would usually suggest using the DataArray constructor here, e.g., `xr.DataArray(output_values, flat_input.coords, flat_input.dims, flat_inputs.attrs)`.
Maybe we can figure a better way to spell ""label these arrays like this template xarray object"" that doesn't require referencing `flat_input` multiple times. Maybe `xarray.label_like(array, source)` or `source.with_data(array)`?
> Would something like xr.unstack_like be desirable?
I'm not sure that a dedicated function `unstack_like` would make sense for xarray. This is the sort of helper function that you can write yourself in a couple of lines.","{""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,352677925