home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 426483497

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/2459#issuecomment-426483497 https://api.github.com/repos/pydata/xarray/issues/2459 426483497 MDEyOklzc3VlQ29tbWVudDQyNjQ4MzQ5Nw== 5635139 2018-10-03T01:30:07Z 2018-10-03T01:30:07Z MEMBER

It's 3x faster to unstack & stack all-but-one level, vs reindexing over a filled-out index (and I think always produces the same result).

Our current code takes the slow path.

I could make that change, but that strongly feels like I don't understand the root cause. I haven't spent much time with reshaping code - lmk if anyone has ideas.

```python

idx = cropped.index full_idx = pd.MultiIndex.from_product(idx.levels, names=idx.names)

reindexed = cropped.reindex(full_idx)

%timeit reindexed = cropped.reindex(full_idx)

1 loop, best of 3: 278 ms per loop

%%timeit stack_unstack = ( cropped .unstack(list('yz')) .stack(list('yz'),dropna=False) )

10 loops, best of 3: 80.8 ms per loop

stack_unstack.equals(reindexed)

True

```

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