home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 403504120

This data as json

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
403504120 MDU6SXNzdWU0MDM1MDQxMjA= 2719 Should xarray.align sort indexes in alignment? 1217238 open 0     1 2019-01-27T01:51:29Z 2019-01-28T18:03:53Z   MEMBER      

I noticed in https://github.com/pandas-dev/pandas/issues/24959 (which turned up as a failure in our test suite) that pandas sorts by default in Index.union and now Index.intersection, unless the indexes are the same or either index has duplicates. (These aspects are probably bugs.)

It occurs to me that we should make an intentional choice about sorting in xarray.align(), rather than merely following the whims of changed upstream behavior. Note that align() is called internally by all xarray operations that combine multiple objects (e.g., in arithmetic).

My proposal is to use "order of appearance" and not sort by default, but add a sort keyword argument to allow users to control this. Reasons for the default behavior of not sorting: 1. Sorting can't be undone if the original order is lost, so this preserve maximum flexibility for users. 2. This matches how we handle the ordering of dimensions in broadcasting. 3. Pandas is quite inconsistent with how it applies sorting and we don't want to copy that in xarray. We definitely don't want to sort in all cases by default (e.g., if objects have the same index), so we should avoid sorting in others.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2719/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 1 row from issue in issue_comments
Powered by Datasette · Queries took 0.587ms · About: xarray-datasette