issue_comments: 1287593498
This data as json
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | performed_via_github_app | issue |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/pydata/xarray/issues/7193#issuecomment-1287593498 | https://api.github.com/repos/pydata/xarray/issues/7193 | 1287593498 | IC_kwDOAMm_X85Mvx4a | 38346144 | 2022-10-22T02:51:50Z | 2022-10-22T09:51:43Z | NONE |
Can I just copy from the doc and use comment to mention the change ``` python In [100]: da = xr.DataArray( ....: np.random.rand(4, 2), ....: [ ....: ("time", pd.date_range("2000-01-01", periods=4)), ....: ("space", ["IA", "IL"]), # do not have the "IN" label ....: ], ....: ) In [101]: times = xr.DataArray( ....: pd.to_datetime(["2000-01-03", "2000-01-02", "2000-01-01"]), dims="new_time" ....: ) In [102]: # use .reindex instead of .sel ....: # and give the parameter : "fill_value" ....: da.reindex(space=xr.DataArray(["IA", "IL", "IN"], dims=["new_time"]), time=times, fill_value=np.nan) Out[102]: <xarray.DataArray (new_time: 3)> array([0.92, 0.34, NaN]) # so fill the missing value by np.nan Coordinates: time (new_time) datetime64[ns] 2000-01-03 2000-01-02 2000-01-01 space (new_time) <U2 'IA' 'IL' 'IN' * new_time (new_time) datetime64[ns] 2000-01-03 2000-01-02 2000-01-01 ``` |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1417641930 |