home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 864523157

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/pull/5365#issuecomment-864523157 https://api.github.com/repos/pydata/xarray/issues/5365 864523157 MDEyOklzc3VlQ29tbWVudDg2NDUyMzE1Nw== 14371165 2021-06-20T09:08:31Z 2021-06-20T09:08:31Z MEMBER

getattr(array_large, "coords", False) will always pass for DataArrays — even if there are no coords, it's checking whether there's a coords method on the class — which in the case of a DataArray with no coords, would return empty (but still return). Or am I misunderstanding?

Empty coords is False as well, that's the trick here:

```python a = xr.DataArray([1, 2]) if getattr(a, "coords", False): print("hey")

b = xr.DataArray([1, 2], coords=[[0, 1]]) if getattr(b, "coords", False): print("hey") hey ```

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  899015876
Powered by Datasette · Queries took 0.707ms · About: xarray-datasette