Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add xarray-specific encoding convention for pd.IntervalArray#10483

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
dcherian wants to merge2 commits intopydata:main
base:main
Choose a base branch
Loading
fromdcherian:interval-coder

Conversation

dcherian
Copy link
Contributor

Closes#2847

Following the proposal in#8005 (comment), this PR adds encoding/decoding machinery forpd.IntervalArray objects. I use an ad-hoc convention:

  1. The data is stacked to a 2D array with the first dimension named__xarray_bounds__. This is not configurable at the moment.
  2. we record encoding attributes"closed", and"dtype" (this is always"pandas_interval").

It is possible to create an IntervalArray with Datetime and Timedelta objects so I've stuck the IntervalCoder first in the encoding pipeline, and last in the decoding pipeline. That way it stays independent.

TODO:

  • Add whats-new
  • Adddecode_intervals kwarg?
  • Add docs to the "Internals" section.

coder = variables.IntervalCoder()
encoded = coder.encode(v)
expected = xr.Variable(
dims=("__xarray_bounds__", "time"),
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

could make this trailing dimension

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Cannot store data aftergroupby_bins
1 participant
@dcherian

[8]ページ先頭

©2009-2025 Movatter.jp