home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 334041813

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/1603#issuecomment-334041813 https://api.github.com/repos/pydata/xarray/issues/1603 334041813 MDEyOklzc3VlQ29tbWVudDMzNDA0MTgxMw== 1217238 2017-10-04T03:40:13Z 2017-10-04T04:15:39Z MEMBER

I sometimes find it helpful to think about what the right repr() looks right, and then work backwards from there to the right data model.

For example, we might imagine that "Indexes" are no longer coordinates, but instead their own entry in the repr: <xarray.Dataset (exp_time: 5)> Coordinates: * experiment (exp_time) int64 0 0 0 1 1 * time (exp_time) float64 0.0 0.1 0.2 0.0 0.15 Indexes: exp_time: pandas.MultiIndex[experiment, time]

"Indexes" might not even need to be part of the main Dataset.__repr__, but it would certainly be the repr for Dataset.indexes. Other entries could include: time: pandas.Datetime64Index[time] space: scipy.spatial.KDTree[latitude, longitude]

In this model:

  1. We would promote "Indexes" to a first-class concept in the xarray data model: (a) The levels of a MultiIndex would have corresponding Variable objects and be found in coords. (b) In contrast, theMultiIndex would not have a corresponding Variable object or be part of coords, though it could still be returned upon __getitem__ access (computed on demand from .indexes). (c) Dataset and DataArray would gain an indexes argument in their constructors, which could be used for passing indexes on to new xarray objects.
  2. Coordinates marked with * are part of an index. They can't be modified, unless all corresponding indexes ares removed.
  3. Indexes would still be propagated, like coordinates.
{
    "total_count": 5,
    "+1": 5,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  262642978
Powered by Datasette · Queries took 0.727ms · About: xarray-datasette