Skip to content

BUG?: should ComplexBlock._can_hold_element/should_store check itemsize?  #32878

Closed
@jbrockmendel

Description

@jbrockmendel
arr = np.arange(5).astype("c8")
ser = pd.Series(arr)
val = np.finfo(np.float64).max
val = val.astype("c16")

>>> val
(1.7976931348623157e+308+0j)

ser[0] = val

>>> ser
0             inf+0.000000e+00j
1    1.000000e+00+0.000000e+00j
2    2.000000e+00+0.000000e+00j
3    3.000000e+00+0.000000e+00j
4    4.000000e+00+0.000000e+00j
dtype: complex64

For IntBlock we check the itemsize to avoid overflows, but for FloatBlock and ComplexBlock we do not, so we get the inf here. Should we instead be upcasting?

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugComplexComplex NumbersIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions