home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 709648652

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
709648652 MDU6SXNzdWU3MDk2NDg2NTI= 4466 convert n-dim array to pandas dataframe 17162724 open 0     3 2020-09-27T02:08:55Z 2020-09-27T19:48:42Z   CONTRIBUTOR      

I just noticed that doing

da = xr.DataArray(np.random.rand(10, 10, 10), dims=('a', 'b', 'c')) da.to_pandas()

gives

```

KeyError Traceback (most recent call last) ~/local/bin/anaconda3/envs/test_env/lib/python3.8/site-packages/xarray/core/dataarray.py in to_pandas(self) 2397 try: -> 2398 constructor = constructors[self.ndim] 2399 except KeyError:

KeyError: 3

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last) <ipython-input-22-2c9fae875981> in <module> ----> 1 da.to_pandas()

~/local/bin/anaconda3/envs/test_env/lib/python3.8/site-packages/xarray/core/dataarray.py in to_pandas(self) 2398 constructor = constructors[self.ndim] 2399 except KeyError: -> 2400 raise ValueError( 2401 "cannot convert arrays with %s dimensions into " 2402 "pandas objects" % self.ndim

ValueError: cannot convert arrays with 3 dimensions into pandas objects ```

It is worth raising a suggestion (see below)? Or could you even do da.to_dataset(name='da').to_dataframe() under the hood. I feel the output would be what the user expects but I imagine that is not always true

da.to_dataset(name='da').to_dataframe()

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4466/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 3 rows from issue in issue_comments
Powered by Datasette · Queries took 0.72ms · About: xarray-datasette