home / github / issues

Menu
  • GraphQL API
  • Search all tables

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 version

x = np.array([0, 1]) np.place(x, x == 0, 1)

pandas version

pd.Series([0, 1]).map({0: 1, 1: 1})

current workaround

ds = xr.Dataset({'test': [0, 1]}) np.place(ds['test'].values, ds['test'].values == 0, 1)

```

Problem description

Is there a built in method to map values like 0 to 1?

Expected Output

returns [1, 1]

{
    "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

Links from other tables

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