home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 255498340

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/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
Powered by Datasette · Queries took 0.969ms · About: xarray-datasette