-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
display the indexes in the string reprs #6795
Conversation
A few thoughts:
Like for variable data, Xarray indexes could implement
I'd skip it for the plain text DataArray / Dataset reprs (not a good information / verbosity ratio), but I'd keep it for the html repr (the index section could be collapsed by default) as well as for the
Assuming that all coordinates related to a given index are shown next to each other, we could render the inline repr for the 1st coordinate and then use a short symbol (e.g.,
I think we can keep it as-is. It helps to identify at a glance which coordinates are indexed and which aren't. And it's still relevant if we skip PandasIndex and PandasMultiIndex in the plain text DataArray / Dataset reprs. |
Shall we point this at the |
From #6867 (#6867 (comment)), we might want to update the "Dimensions without coordinates" line too. |
If we're encouraging people to look at these / subclass them to create custom indexes, then they should have a repr too. |
I think we should move forward here. Are there any real blockers? |
not really, I wanted to wait until Edit: we don't yet have tests, though There's two issues left that might need a bit of discussion: in 8f21df3 I skipped displaying default Another proposal we had was to replace the "dimensions without coordinates" line with a "coordinates without index" line. @benbovy, this might be a misunderstanding on my part, but I thought "dimension coordinates" (and in particular their indexes) are still used for alignment? If so, I think we might need both lines. |
Looks good to me @keewis. Thanks for your work on the indexes repr! Yes I think we can skip displaying default indexes for now... The question is which indexes are considered as default, i.e., all
Yes that's a good point. Let's keep "dimensions without coordinates". |
With the flexible indexes refactor indexes have become much more important, which means we should include them in the reprs of
DataArray
andDataset
objects.This is a initial attempt, covering only the string reprs, with a few unanswered questions:
__repr__
or some other method?PandasIndex
andPandasMultiIndex
?(also, how do we best test this?)
whats-new.rst