home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 448677802

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/pull/2621#issuecomment-448677802 https://api.github.com/repos/pydata/xarray/issues/2621 448677802 MDEyOklzc3VlQ29tbWVudDQ0ODY3NzgwMg== 1217238 2018-12-19T17:26:36Z 2018-12-19T17:26:36Z MEMBER

Should we update levels after indexing or when stacking? Pandas does the later: ``` In [31]: import pandas as pd

In [32]: mindex = pd.MultiIndex.from_product([[1, 2, 3], ['a', 'b']])

In [33]: s = pd.Series(range(6), mindex)

In [34]: s.loc[:1].index Out[34]: MultiIndex(levels=[[1, 2, 3], ['a', 'b']], labels=[[0, 0], [0, 1]])

In [35]: s.loc[:1].unstack() Out[35]: a b 1 0 1 ```

The advantage of waiting until unstacking is that removing unused levels could be expensive compared to indexing: it runs in time O(L+N), where L is the size of the original level and N is the length of the new multi-index.

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