issue_comments: 369294450
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/1949#issuecomment-369294450 | https://api.github.com/repos/pydata/xarray/issues/1949 | 369294450 | MDEyOklzc3VlQ29tbWVudDM2OTI5NDQ1MA== | 1217238 | 2018-02-28T16:23:40Z | 2018-02-28T16:23:40Z | MEMBER | If you're OK creating a new Dataset, it works to remove any variables using a dimension, e.g., ``` In [25]: test_dataset = xr.Dataset(dict( ...: empty_array=xr.DataArray([], dims='a'), ...: populated_array=xr.DataArray([1], {'b':['1']}, 'b') ...: )) ...: In [26]: test_dataset Out[26]: <xarray.Dataset> Dimensions: (a: 0, b: 1) Coordinates: * b (b) <U1 '1' Dimensions without coordinates: a Data variables: empty_array (a) float64 populated_array (b) int64 1 In [27]: test_dataset.drop('empty_array') Out[27]: <xarray.Dataset> Dimensions: (b: 1) Coordinates: * b (b) <U1 '1' Data variables: populated_array (b) int64 1 ``` You're right that this doesn't work to remove dimensions from existing datasets (e.g., with In [47]: del test_dataset['b'] In [48]: test_dataset Out[48]: <xarray.Dataset> Dimensions: (a: 0, b: 1) Dimensions without coordinates: a, b Data variables: empty_array (a) float64 populated_array (b) int64 1 In [49]: del test_dataset['populated_array'] In [50]: test_dataset Out[50]: <xarray.Dataset> Dimensions: (a: 0, b: 1) Dimensions without coordinates: a, b Data variables: empty_array (a) float64 ```
This used to be possible in the xarray data model prior to v0.9.0. When we made coordinates optional, I updated I'd like to suggest two possible fixes:
1. Update |
{ "total_count": 1, "+1": 1, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
301031693 |