issues: 383945783
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
383945783 | MDU6SXNzdWUzODM5NDU3ODM= | 2568 | Xarray equivalent of np.place or df.map(mapping)? | 15331990 | closed | 0 | 11 | 2018-11-24T00:33:11Z | 2022-04-18T15:51:57Z | 2022-04-18T15:51:57Z | CONTRIBUTOR | ```python numpy versionx = np.array([0, 1]) np.place(x, x == 0, 1) pandas versionpd.Series([0, 1]).map({0: 1, 1: 1}) current workaroundds = xr.Dataset({'test': [0, 1]}) np.place(ds['test'].values, ds['test'].values == 0, 1) ``` Problem descriptionIs there a built in method to map values like 0 to 1? Expected Outputreturns |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2568/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |