Skip to content

Conversation

@rhshadrach
Copy link
Member

@rhshadrach rhshadrach commented Dec 4, 2025

No whatsnew as this regression was introduced as part of 3.0 development.

The issue is multiplication with complex numbers and infinities can be surprising:

print(1j * float("inf"))
# (nan+infj)

The NaN comes from inf being interpreted as inf + 0j. Then (inf + 0j) * (0 + 1j) makes the real part consist of inf * 0 + 0j * 1j with inf*0 giving nan. We therefore need to avoid multiplication.

@rhshadrach rhshadrach added this to the 3.0 milestone Dec 4, 2025
@rhshadrach rhshadrach added Bug Regression Functionality that used to work in a prior pandas version Interval Interval data type labels Dec 4, 2025
comb = (np.array(left.ravel(), dtype="complex128")) + (
1j * np.array(right.ravel(), dtype="complex128")
)
comb = np.array(left.ravel(), dtype="complex128")
Copy link
Member

Choose a reason for hiding this comment

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

Could we use np.asarray? (NumPy might copy anyways but would be nice if it didn't in this case)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Interval Interval data type Regression Functionality that used to work in a prior pandas version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Inconsisten nunique behavior with Intervals on latest nightly

2 participants