Pandas version checks
-
[x] I have checked that this issue has not already been reported.
-
[x] I have confirmed this bug exists on the latest version of pandas.
-
[x] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
ser = pd.Series([0], dtype="Float64")
>>> ser == False
0 True
dtype: boolean
Issue Description
NA
Expected Behavior
I would expect this to be stricter in type-safety. The lack of strictness necessitates special-casing in mask_missing (called from Block.replace).
Note that these also compare as equal for numpy float64 and float64[pyarrow]
Installed Versions
Comment From: rhshadrach
This impacts all dtypes (bool, int, float) with all storage types (NumPy, PyArrow) I believe. NumPy and Polars also behave the same way - giving True
as the result. While I don't necessarily disagree with the idea of not allowing Boolean and float to compare as equal, it seems like we might be creating a new special behavior by doing so.
Comment From: jbrockmendel
Fair point, not worth it for the foreseeable future. Closing.