home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 739334281

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/3929#issuecomment-739334281 https://api.github.com/repos/pydata/xarray/issues/3929 739334281 MDEyOklzc3VlQ29tbWVudDczOTMzNDI4MQ== 29051639 2020-12-05T18:52:49Z 2020-12-05T18:52:49Z CONTRIBUTOR

For context this is the function I'm using to convert the Dask DataFrame to a DataArray.

```python def from_dask_dataframe(df, index_name=None, columns_name=None): def extract_dim_name(df, dim='index'): if getattr(df, dim).name is None: getattr(df, dim).name = dim

    dim_name = getattr(df, dim).name

    return dim_name

if index_name is None:
    index_name = extract_dim_name(df, 'index')
if columns_name is None:
    columns_name = extract_dim_name(df, 'columns')

da = xr.DataArray(df, coords=[df.index, df.columns], dims=[index_name, columns_name])

return da

df.index.name = 'datetime' df.columns.name = 'fueltypes'

da = from_dask_dataframe(df) ```

I'm also conscious that my question is different to @raybellwaves' as they were asking about Dataset creation and I'm interested in creating a DataArray which requires different functionality. I'm assuming this is the correct place to post though as @keewis closed my issue and linked to this one.

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