DataFrame.equals false negatives with dtype=object · Issue #8437 · pandas-dev/pandas (original) (raw)
I still don't have a good enough grasp on the internals to go diving for this one quickly, but here's the observed behavior:
In [1]: import pandas as pd
In [2]: import numpy as np
In [3]: temp = [pd.Series([False, np.nan]), pd.Series([False, np.nan]), pd.Series(index=range(2)), pd.Series(index=range(2)), pd.Series(index=range(2)), pd.Series(index=range(2))]
In [4]: temp[2][:-1] = temp[3][:-1] = temp[4][0] = temp[5][0] = False
In [5]: [[x.equals(y) for y in temp] for x in temp] Out[5]: [[True, True, False, False, False, False], [True, True, False, False, False, False], [False, False, True, False, False, False], [False, False, False, True, False, False], [False, False, False, False, True, True], [False, False, False, False, True, True]]
Here the 4x4 square in the upper left should be True
. (temp[4:6]
are different because inserting False
into a float64
array or vice-versa coerces False
into 0.0
; this is inconvenient when attempting to use the array for boolean indexing.)