Can anyone explain the following strange behaviour in Python?
>>>set([np.nan, np.nan, np.nan])
{np.nan}
as expected, but:
>>>set(pd.Series([np.nan, np.nan, np.nan]))
{np.nan, np.nan, np.nan}
They're all just floats:
>>>[type(a) for a in set(pd.Series([np.nan, np.nan, np.nan]))]
[float, float, float]
How can this set have three objects that are the same?
Versions:
- Python 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)]
- NumPy 1.15.1
- Pandas 0.23.4