issue_comments: 586959508
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/3348#issuecomment-586959508 | https://api.github.com/repos/pydata/xarray/issues/3348 | 586959508 | MDEyOklzc3VlQ29tbWVudDU4Njk1OTUwOA== | 37239554 | 2020-02-17T11:52:32Z | 2020-02-17T11:52:32Z | NONE | The problem is still there, as it is quite unexpected. I hacked it using .astype() directly in the np.array Test code```python import xarray as xr da = xr.DataArray( np.arange(56).reshape((7, 8)), coords={ 'x': list('abcdefg'), 'y': 10 * np.arange(8) }, dims=['x', 'y'], attrs={"at_str":"at1_value","at_float":123.,"at_int":123} ) print("Original xr.DataArray") print(f"attrs: {da.attrs}") print(f"dtype: {da.dtype}") print(f"\nAfter casting to int64: {da.astype(np.int64).attrs}" ) print(f"After casting to int32: {da.astype(np.int32).attrs}" ) print(f"After casting to float32: {da.astype(np.float32).attrs}") da.values = da.values.astype(np.float32) print("\nChanging the np.array") print(f"attrs: {da.attrs}") print(f"dtype: {da.dtype}") ``` Output:``` Original xr.DataArray attrs: {'at_str': 'at1_value', 'at_float': 123.0, 'at_int': 123} dtype: int64 After casting to int64: {} After casting to int32: {} After casting to float32: {} Changing the np.array attrs: {'at_str': 'at1_value', 'at_float': 123.0, 'at_int': 123} dtype: float32 ```
|
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
499196320 |