home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 650738680

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/4186#issuecomment-650738680 https://api.github.com/repos/pydata/xarray/issues/4186 650738680 MDEyOklzc3VlQ29tbWVudDY1MDczODY4MA== 15720911 2020-06-28T11:37:20Z 2020-06-28T11:37:20Z NONE

It seems the problem here is in Dataset.from_dataframe the dims and coords are created with df.index.levels which is unsorted: https://github.com/pydata/xarray/blob/732750a06aef2025b206ba6ff765f5acc53bfa25/xarray/core/dataset.py#L4642-L4643

Then in Dataset._set_numpy_data_from_dataframe, the pd.MultiIndex.from_product and dataframe.reindex unintentionally sort the dataframe by index: https://github.com/pydata/xarray/blob/732750a06aef2025b206ba6ff765f5acc53bfa25/xarray/core/dataset.py#L4588-L4589

Besides the perf improvement it provides, #4184 seems also have a nice side effect fixing this issue.

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