Skip to content

divide by 0 for Int64 is inconsistent with int64 #22793

Closed
@hhuuggoo

Description

@hhuuggoo
In [5]: pd.Series([1], dtype='Int64') / pd.Series([0], dtype='Int64')                                                                                                                                                                                                           
Out[5]:                                                                                                                                                                                                                                                                         
0   NaN                                                                                                                                                                                                                                                                         
dtype: float64     

Where as

In [6]: pd.Series([1], dtype='int64') / pd.Series([0], dtype='int64')                                                                                                                                                                                                           
Out[6]:                                                                                                                                                                                                                                                                         
0    inf                                                                                                                                                                                                                                                                        
dtype: float64        

It's because of this line:

mask |= (result == np.inf) | (result == -np.inf)

Is it intentional for the new extension integer type to have different behavior here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugExtensionArrayExtending pandas with custom dtypes or arrays.NA - MaskedArraysRelated to pd.NA and nullable extension arraysNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions