home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 658912550

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-658912550 https://api.github.com/repos/pydata/xarray/issues/4228 658912550 MDEyOklzc3VlQ29tbWVudDY1ODkxMjU1MA== 10563614 2020-07-15T17:54:57Z 2020-07-15T18:29:20Z CONTRIBUTOR

thanks for the very clear response. The behaviro make sense.

In fact, I should have explained what I'm trying to achieve, as this is kind of "take". I've a dict like this: python {'label1' : dict(coord1=1, coord2=4), 'label2' : dict(coord1=5, coord2=6), 'label3' : dict(coord1=4, coord2=2), } and I want to build an xarray (and then a dataframe) with coord1 and coord2 replaced by a new dims with values 'label1', 'label2', 'label3'.

I've done that by iterating over the dict, selecting with sel using the dict values, convert to dataframe and then concat the dataframes. pd.concat([x.sel(**d[k]).to_dataframe() or k in d]

A better option would be to do this "sel" or "take" with xarray only. Do you have an idea how to do it with existing xarray methods?

{
    "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 159.351ms · About: xarray-datasette