Skip to content
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

fix and test empty CFTimeIndex #8600

Merged
merged 14 commits into from
Jan 15, 2024

Conversation

mathause
Copy link
Collaborator

@mathause mathause commented Jan 8, 2024

Otherwise da.indexes and the html repr raise a ValueError. I first had "<undefined>" but I think None is better. cc @spencerkclark @keewis

xarray/coding/cftimeindex.py Outdated Show resolved Hide resolved
@mathause mathause changed the title fix empty cftimeindex repr fix and test empty CFTimeIndex Jan 12, 2024
@mathause
Copy link
Collaborator Author

I updated CFTimeIndex to work for no data. I tried to get the same behavior as pandas and am happy to get feedback.

Copy link
Member

@spencerkclark spencerkclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mathause! This looks pretty much ready for a what's new entry from my perspective.

xarray/coding/cftimeindex.py Outdated Show resolved Hide resolved
xarray/tests/test_cftimeindex.py Outdated Show resolved Hide resolved
xarray/tests/test_cftimeindex.py Outdated Show resolved Hide resolved
Copy link
Member

@spencerkclark spencerkclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good — thanks again!

@dcherian dcherian merged commit 53fdfca into pydata:main Jan 15, 2024
26 checks passed
@mathause mathause deleted the fix_empty_cftimeindex_repr branch January 17, 2024 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

html repr fails for empty cftime arrays
4 participants