-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: clean IntervalArray._simple_new #50305
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
CLN: clean IntervalArray._simple_new #50305
Conversation
pandas/core/arrays/interval.py
Outdated
closed: IntervalClosedType | None = None, | ||
copy: bool = False, | ||
dtype: Dtype | None = None, | ||
dtype: IntervalDtype, | ||
verify_integrity: bool = True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally we'd get verify_integrity out of _simple_new
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made an implementation for this, see latest commit.
The arm failure looks unrelated. |
a8799f9
to
746bf29
Compare
I've updated the PR. |
@@ -102,6 +105,7 @@ | |||
|
|||
|
|||
IntervalArrayT = TypeVar("IntervalArrayT", bound="IntervalArray") | |||
IntervalSideT = Union[TimeArrayLike, np.ndarray] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice. an option if you want to be more specific can specify npt.NDArray[numeric_dtypes]
. OK to call this out of scope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do it in a follow-up? I think I'd prefer an iterative approach, i.e. closing the book on this method cleaning PR and picking up the typing issue as a new PR.
thanks @topper-123 |
There is a lot of code in
IntervalArray._simple_new
. I suggest moving all the code there that checks that the input data is correct into its own method (_ensure_simple_new_inputs
), so we have a better split between building the ÌntervalArray` and checking that its inputs are correct.This PR changes no functionality.