home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 337623613

This data as json

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/issues/1635#issuecomment-337623613 https://api.github.com/repos/pydata/xarray/issues/1635 337623613 MDEyOklzc3VlQ29tbWVudDMzNzYyMzYxMw== 7441788 2017-10-18T15:08:57Z 2017-10-18T15:08:57Z CONTRIBUTOR

I think that makes sense, though I don't quite understand what would go in its place. Another possibility -- perhaps a bad one -- is to permute the values in the sorted dimension so that they match the resulting values (i.e. something like result.coords[dim] = np.take(da.coords[dim].values, result.values, axis=axis)).

Note that ndarray.argsort(axis=None) sorts the flattened array, so the returned DataArray should respect this

Alternative suggestion: have DataArray.argsort() return an ndarray filled with labels from the sorted dimension, i.e. something like: class DataArray: def argsort(self, **kwargs): # TODO: update kwargs['axis'] based 'axis' and 'dim', and remove 'dim' if kwargs['axis'] is None: kwargs['axis'] = -1 return self.stack(dim=self.dims).argsort(**kwargs) return np.take(self.coords[self.dims[kwargs['axis']].values, self.values.argsort(**kwargs))

BTW, I'm just thinking in terms of ndarrays. Someone more knowledgeable than me may want to consider how to make it work intelligently with dask.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  266133430
Powered by Datasette · Queries took 1.21ms · About: xarray-datasette