pull_requests: 209931263
This data as json
id | node_id | number | state | locked | title | user | body | created_at | updated_at | closed_at | merged_at | merge_commit_sha | assignee | milestone | draft | head | base | author_association | auto_merge | repo | url | merged_by |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
209931263 | MDExOlB1bGxSZXF1ZXN0MjA5OTMxMjYz | 2375 | closed | 0 | Make `dim` optional on unstack | 4806877 | - [x] Tests added (for all bug fixes or enhancements) - [x] Tests passed (for all non-documentation changes) - [x] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API (remove if this change should not be visible to users, e.g., if it is an internal clean-up, or if this is part of a larger project that will be documented later) Not sure if this is a desirable change but I thought it could be easily discussed as a PR. Just for context I was looking at flattening spatial data for machine learning pipelines and then reshaping after the output had been acquired. I have a NxM array called `b` and am flattening it like: ```python flat_input = b.stack(z=('y', 'x')) ``` Then I use that flat_input in my ML pipeline and get back an `np.array` (called `output`) which I want to unstack using all the metadata that went into stacking my original NxM array b. ```python xr.full_like(flat_input, output).unstack(dim='z') ``` This PR just makes the `dim` argument optional in unstack so that we can use ```python xr.full_like(flat_input, output).unstack() ``` As a follow on PR I was thinking of making a function called `xr.unstack_like(other: xr.DataArray|xr.Dataset, data: array_like)` to encompass this functionality. A couple questions: 1) Would something like `xr.unstack_like` be desirable? 2) Should we be using `xr.full_like` in this way? The documentation in xarray and numpy only mentions scalars, but arrays work fine in both. If this is a supported behavior I could add docs, and if not perhaps a copy and overwrite is a better approach? Here is a gist of the workflow using a tweaked datashader example and datashader example data https://gist.github.com/jsignell/79a6cf2da5c1458211d9dcf34d4417df | 2018-08-21T19:29:06Z | 2018-09-05T16:01:23Z | 2018-09-05T15:19:07Z | 2018-09-05T15:19:07Z | 73f5b02a42a4003815d2bfc91e658195f5050be1 | 0 | 7ec32529652c9b19b18e747154a31b20d2c57b6e | 69086b332c6c950587830b266df4e624c2106d89 | CONTRIBUTOR | 13221727 | https://github.com/pydata/xarray/pull/2375 |
Links from other tables
- 0 rows from pull_requests_id in labels_pull_requests