pydata / pydata/xarray

Allow Custom Indexes to define HTML repr for managed coords

Open
#11,018 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

Is your feature request related to a problem?

When a complicated index is attached to a dataset it can potentially fill up the coords field with lots of extra low value information. For example for the builtin multiindex the xarray version looks like this:

Image

which is lower signal to noise than the equivalent pandas repr:

Image

or in the case of layered intervals annotating a dimension (https://ianhuntisaak.com/xarray-linked-indexes/) the coords can really get out of hand

Image
Describe the solution you'd like

Allow Indexes to override the default html repr for any coords that they manage. The dataset repr can compose itself out of the reprs for coords from coords, so the would be in charge of returing the html +/- css for those coords

I think the built in multindex could be a nice example use case of this.

Describe alternatives you've considered

No response

Additional context

No response

cc @benbovy @keewis @dcherian

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how Dataset reprs compose HTML for managed coordinates, then compare the existing xarray and pandas MultiIndex representations. The issue's target is an Index-level HTML repr that the Dataset can compose for its managed coords; done means custom indexes can reduce excessive coordinate output while preserving useful information.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.