Skip to content

Conversation

@topper-123
Copy link
Contributor

@topper-123 topper-123 commented Dec 16, 2022

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.

@mroeschke mroeschke added the Interval Interval data type label Dec 19, 2022
copy: bool = False,
dtype: Dtype | None = None,
dtype: IntervalDtype,
verify_integrity: bool = True,
Copy link
Member

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

Copy link
Contributor Author

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.

@topper-123
Copy link
Contributor Author

The arm failure looks unrelated.

@topper-123 topper-123 force-pushed the clean_IntervalArray._simple_new branch from a8799f9 to 746bf29 Compare December 26, 2022 20:02
@topper-123
Copy link
Contributor Author

I've updated the PR.



IntervalArrayT = TypeVar("IntervalArrayT", bound="IntervalArray")
IntervalSideT = Union[TimeArrayLike, np.ndarray]
Copy link
Member

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

Copy link
Contributor Author

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.

@jbrockmendel jbrockmendel merged commit 184e167 into pandas-dev:main Jan 2, 2023
@jbrockmendel
Copy link
Member

thanks @topper-123

@topper-123 topper-123 deleted the clean_IntervalArray._simple_new branch January 21, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Interval Interval data type

3 participants