Skip to content

BUG: Fixed IntervalArray[int].shift #31502

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

Merged
merged 9 commits into from
Feb 4, 2020

Conversation

TomAugspurger
Copy link
Contributor

Closes #31495

In ExtensionArray.shift, we have the note

        # Note: this implementation assumes that `self.dtype.na_value` can be
        # stored in an instance of your ExtensionArray with `self.dtype`.

I wonder, should we have a method / property like

@property
def _can_hold_na_value(self):
    return True

And for IntervalArray, we would do something like

@property
def _can_hold_na_value(self):
    return is_float_dtype(self.dtype.subtype)

That would let us deduplicate things, since the call to _from_sequence would know to not pass dtype=self.dtype and trigger a re-inference.

@TomAugspurger
Copy link
Contributor Author

cc @jschendel for thoughts on that.

@TomAugspurger
Copy link
Contributor Author

TomAugspurger commented Jan 31, 2020

This is still failing for interval[datetime64], since we try to concat a float (all NaN) and datetime. Will poke around a bit.

@TomAugspurger
Copy link
Contributor Author

The datetime64 failure is present on master. I've opened #31504 for it.

@jbrockmendel
Copy link
Member

LGTM, agreed it would be nice to find a way to make this work in the general case.

@jreback jreback added this to the 1.0.1 milestone Feb 1, 2020
@jreback jreback added Interval Interval data type Numeric Operations Arithmetic, Comparison, and Logical operations Regression Functionality that used to work in a prior pandas version labels Feb 1, 2020
@TomAugspurger
Copy link
Contributor Author

All green now. Sorry about the string of CI failures earlier.

Copy link
Member

@jschendel jschendel left a comment

Choose a reason for hiding this comment

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

lgtm, thanks

Co-Authored-By: Joris Van den Bossche <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Interval Interval data type Numeric Operations Arithmetic, Comparison, and Logical operations Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Series shift method breaks for series of pandas Intervals in Pandas 1.0 (works in 0.25.3)
5 participants