Skip to content

astype_nansafe int to float with copy=False produces incorrect result #23092

Closed
@TomAugspurger

Description

@TomAugspurger

I haven't investigated this at all. Maybe it's expected

In [6]: pd.core.dtypes.cast.astype_nansafe(a, float)
Out[6]: array([1., 2., 3.])

In [7]: pd.core.dtypes.cast.astype_nansafe(a, float, copy=False)
Out[7]: array([4.9e-324, 9.9e-324, 1.5e-323])

To whoever maybe fixes this in the future, _sparse_array_ops in sparse/array.py would like to use copy=False somewhere around

        left = left.astype(ltype)
        right = right.astype(rtype)
        dtype = ltype.subtype

Metadata

Metadata

Assignees

No one assigned

    Labels

    Dtype ConversionsUnexpected or buggy dtype conversionsMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions