Binary operations between Numpy array and Pandas series convert to array dtype before executing #8674
Labels
Bug
Dtype Conversions
Unexpected or buggy dtype conversions
Numeric Operations
Arithmetic, Comparison, and Logical operations
Milestone
It looks like when you do a binary operation with a numpy array and a pandas series, the Pandas series is cast as the same type as the numpy array. In the case where the array is
ints
but the series isfloats
this can have odd results in Python 2.x with division. This was surprising to me because, element-wise, a float/int computation would upcast the denominator to a float. But not here in this vectorized case:So in the two "pure" cases (array and array, series and series) the ints are upcast to floats and we get 0's everywhere. In the 2nd mixed case (3rd case overall), everything gets converted to floats to match the array and everything goes fine. But in the 1st mixed case (2nd case overall) everything gets converted to ints to match the array and so you get what was, at least to me, an unexpected infinite result.
The text was updated successfully, but these errors were encountered: