home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 658884817

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/4228#issuecomment-658884817 https://api.github.com/repos/pydata/xarray/issues/4228 658884817 MDEyOklzc3VlQ29tbWVudDY1ODg4NDgxNw== 2448579 2020-07-15T17:02:14Z 2020-07-15T17:02:14Z MEMBER

You need xr.DataArray([1], coords=[('onecoord', [2])]).sel(onecoord=[2]).to_dataframe(name='name')

The difference is using onecoord=2 gives a scalar ```

xr.DataArray([1], coords=[('onecoord', [2])]).sel(onecoord=2) <xarray.DataArray ()> array(1) Coordinates: onecoord int64 2 ```

while using onecoord=[2] gives a 1 element vector ```

xr.DataArray([1], coords=[('onecoord', [2])]).sel(onecoord=[2]) <xarray.DataArray (onecoord: 1)> array([1]) Coordinates: * onecoord (onecoord) int64 2 ```

And to_dataframe cannot handle scalars.

I am not sure that there is a sensible way to convert a scalar DataArray to a DataFrame but we should throw a more informative error in any case.

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