home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

2 rows where user = 92899389 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date), closed_at (date)

type 2

  • issue 1
  • pull 1

state 2

  • closed 1
  • open 1

repo 1

  • xarray 2
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
1949782787 PR_kwDOAMm_X85dJLvY 8332 Add invert option to DataArray/Dataset.stack() carschandler 92899389 open 0     9 2023-10-18T13:38:38Z 2024-04-29T16:29:40Z   FIRST_TIME_CONTRIBUTOR   0 pydata/xarray/pulls/8332

This brings in the option to stack all dimensions except for one or more dimensions listed. I find this very useful for quickly iterating over all the combinations of dimensions except for one (i.e. you have a number of input parameters that are parameterized and one time dimension, and you want to calculate some time response for all the combinations of these input parameters and store them in the time-row corresponding to the appropriate combination of inputs).

I played around with implementing to_stacked_array() for DataArray, but this made less sense in the end since that method was really designed for Datasets.

  • [x] Addresses #8278
  • [ ] Tests added (added one for DataArray, just now realizing I should have one for Dataset)
  • [ ] User visible changes (including notable bug fixes) are documented in whats-new.rst
  • [ ] New functions/methods are listed in api.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8332/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1930702782 I_kwDOAMm_X85zFC-- 8278 A way to `stack` all dimensions but one? carschandler 92899389 closed 0     3 2023-10-06T17:48:18Z 2023-10-06T20:58:20Z 2023-10-06T20:58:20Z NONE      

Is your feature request related to a problem?

One thing I find useful with DataArrays is the ability to take all dimensions but one, stack them into one MultiIndex, and then iterate over the entries of that MultiIndex. For example, I have a DataArray that starts with a time dimension/coordinate. I then add several new dimensions/coords that correspond to varying input parameters (i.e. one for initial velocity, initial position, air density, etc.). What I then want to do is iterate over all 1D time vectors (all the combinations of those variable input parameters). The easiest way I've found to do this is to stack all the dimensions except time and then iterate over the resulting MultiIndex. I have been doing this by converting the dims of the DataArray to a list and then removing "time" from that list and using it as the input to stack.

Describe the solution you'd like

It would be awesome if there was a method that could specifically stack all dimensions except for a list of specified dimension names (something like DataArray.stack_except({"name_of_created_stacked_dimension": ["dim_to_leave_unstacked", "another_dim"])), or some kind of syntax that would allow an "all except" behavior to be passed directly into stack (could be something like `DataArray.stack({"name_of_created_stacked_dimension"}: ["dim_to_leave_unstacked"], invert=True).

Describe alternatives you've considered

If there is a better way to achieve what I'm trying to accomplish (take one dimension and iterate over all the combinations of the other dimensions, resulting in 1D vectors that vary along the single desired dimension), then I would welcome any tips!

Additional context

No response

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

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 22.73ms · About: xarray-datasette