-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Description
This is a datatype thing I believe. When I construct a DataFrame and then compare rows of that, NaNs are not ignored contrary to the documentation.
import pandas as pd
import numpy as np
a = pd.DataFrame([{'A': 1, 'B': 'b', 'C': np.NAN}, {'A': 1, 'B': 'b', 'C': 1}])
b = pd.DataFrame([{'A': 1, 'B': 'b', 'C': np.NAN}, {'A': 1, 'B': 'b', 'C': 1}])
a.loc[0]
A 1
B b
C NaN
Name: 0, dtype: object
aa = a.loc[0]
bb = b.loc[0]
aa.equals(bb)
False
# which essentially does this in Block
aa.values == bb.values
Out[35]: array([ True, True, False], dtype=bool)
Constructing the series outright works as advertised.
a = pd.Series({'A': 1, 'B': 'b', 'C': np.NAN})
b = pd.Series({'A': 1, 'B': 'b', 'C': np.NAN})
a.equals(b)
True
a.values == b.values
Out[30]: array([ True, True, True], dtype=bool)
Metadata
Metadata
Assignees
Labels
No labels