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/1028#issuecomment-268273685,https://api.github.com/repos/pydata/xarray/issues/1028,268273685,MDEyOklzc3VlQ29tbWVudDI2ODI3MzY4NQ==,4160723,2016-12-20T15:34:34Z,2016-12-20T15:34:34Z,MEMBER,This should now behave correctly with optional indexes.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,180638999
https://github.com/pydata/xarray/pull/1028#issuecomment-267509336,https://api.github.com/repos/pydata/xarray/issues/1028,267509336,MDEyOklzc3VlQ29tbWVudDI2NzUwOTMzNg==,1217238,2016-12-16T03:33:40Z,2016-12-16T03:33:40Z,MEMBER,Can we update this for optional indexes? (now on master),"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,180638999
https://github.com/pydata/xarray/pull/1028#issuecomment-260796716,https://api.github.com/repos/pydata/xarray/issues/1028,260796716,MDEyOklzc3VlQ29tbWVudDI2MDc5NjcxNg==,4160723,2016-11-15T22:54:18Z,2016-11-15T22:54:18Z,MEMBER,"This is ready for another round of review.
I've changed the signature of `reset_index` to option C. It is also almost ready for #1017 (just added two small TODOs).
> Did you go for allowing set_index() to rename variables?
Not yet, but as you said we could safely add this later.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,180638999
https://github.com/pydata/xarray/pull/1028#issuecomment-259476665,https://api.github.com/repos/pydata/xarray/issues/1028,259476665,MDEyOklzc3VlQ29tbWVudDI1OTQ3NjY2NQ==,1217238,2016-11-09T17:43:31Z,2016-11-09T17:43:31Z,MEMBER,"I kind of like Option C, given that we have guaranteed level names and variables to have no conflicts.
Did you go for allowing `set_index()` to rename variables?
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,180638999
https://github.com/pydata/xarray/pull/1028#issuecomment-258887083,https://api.github.com/repos/pydata/xarray/issues/1028,258887083,MDEyOklzc3VlQ29tbWVudDI1ODg4NzA4Mw==,4160723,2016-11-07T16:37:03Z,2016-11-07T16:37:03Z,MEMBER,"Just committed review changes.
`.reset_index()` doesn't accept kwargs anymore, though I don't know what to choose between the options below (currently option A is implemented):
- option A: `reset_index(dim, levels=None)` where `dim` may accept multiple dimension names (in
that case `levels` must be a list of lists with the same length than `dim`, or simply `None` that
would then be applied to all given dimensions).
- option B: same than option A, `reset_index(dim, levels=None)`, except that `dim` only accepts
one dimension (thus a bit simpler but less flexible).
- option C: `reset_index(dim_or_levels)` where one can provide a list of dimension(s) and/or
level(s). This is the most flexible and concise, though maybe less readable. Allow providing both
dimensions and levels may be ambiguous too.
> if x is a normal (non-multi) Index, array.reset_index('x') is not well defined
Currently `.reset_index()` doesn't allow resetting normal indexes, but we can wait for #1017 before merging this.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,180638999
https://github.com/pydata/xarray/pull/1028#issuecomment-258497688,https://api.github.com/repos/pydata/xarray/issues/1028,258497688,MDEyOklzc3VlQ29tbWVudDI1ODQ5NzY4OA==,4160723,2016-11-04T17:34:33Z,2016-11-04T17:34:33Z,MEMBER,"Sorry for the delay @shoyer. I've read your comments above and they all seem relevant. I'll find some time next week to get back on this.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,180638999
https://github.com/pydata/xarray/pull/1028#issuecomment-255498340,https://api.github.com/repos/pydata/xarray/issues/1028,255498340,MDEyOklzc3VlQ29tbWVudDI1NTQ5ODM0MA==,1217238,2016-10-22T01:18:40Z,2016-10-22T01:18:40Z,MEMBER,"> We need to choose whether to use dim=indexes kwargs or fixed arg/kwarg relative to a given dimension for the signatures of .set_index(), .reset_index() and .reorder_levels().
For `set_index` and `reorder_levels`, I like the kwargs or a dictionary. It's nice and explicit. But for `reset_index`, I think we probably want a list.
It's not at all obvious to me what `array.reset_index(x=None)` does. It could just as easily mean ""reset nothing from `x`"" as ""reset `x` to have a null index"". In fact, the former seems more consistent with how we handle levels. In contrast, `array.reset_index(['x'])` pretty clearly means that the `'x'` index should be reset.
> Do we also allow .set_index() to rename the dimension(s) if needed, instead of doing .set_index(...).rename(...) ? Is this a common use case that is worth it?
My inclination is yes -- this feels like a common thing to do. But we could also safely add this later.
> After discussion in #1017, it seems that we need an easy way to (re)set indexes either to no index or to range(n).
We definitely need a way to reset indexes to the default, but after #1017, I'm not sure we will need a way to set them to `range(n)`.
Unfortunately, if `x` is a normal (non-multi) Index, `array.reset_index('x')` is not well defined. We need a name for the variable that was formerly named `x` (or could drop it, e.g., with `array.reset_index('x', drop=True)` or `array.drop('x')`), otherwise it will still be the index for the x-axis. Or, I suppose we could rename the `x` dimension to something else.
One option is to add some sort of prefix or suffix to the index name when it becomes a new variable, e.g., `array.reset_index('x')` renames the coordinate `x` to `x_`. This seems like a probably safe choice, though I hate to add more automatic names to the API.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,180638999
https://github.com/pydata/xarray/pull/1028#issuecomment-255070082,https://api.github.com/repos/pydata/xarray/issues/1028,255070082,MDEyOklzc3VlQ29tbWVudDI1NTA3MDA4Mg==,4160723,2016-10-20T10:32:57Z,2016-10-20T10:34:21Z,MEMBER,"Some API design questions (mostly from @shoyer's review) we need to fix:
- We need to choose whether to use `dim=indexes` kwargs or fixed arg/kwarg relative to a given dimension for the signatures of `.set_index()`, `.reset_index()` and `.reorder_levels()`.
- Do we also allow `.set_index()` to rename the dimension(s) if needed, instead of doing `.set_index(...).rename(...)` ? Is this a common use case that is worth it?
- After discussion in #1017, it seems that we need an easy way to (re)set indexes _either_ to no index _or_ to range(n).
For point 1, my preference goes to `dim=indexes` kwargs, especially if we need 2 and 3. It's less succinct, but it's more close to the signatures of other xarray methods like `.reindex()` or `.sel()`, and it allows (re)setting the indexes of multiple dimensions in a single call. Given 2, I find `set_index(new_dim_name=['level_1', 'level_3'])` a bit more elegant than `set_index(['level_1', 'level_2'], name='new_dim_name')`. Given 3, `array.reset_index('x')` seems ambiguous compared to `array.reset_index(x=None)` (no index) and, e.g., `array.reset_index(x='range')` (range(n) index).
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,180638999