Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pandas/core/ops/array_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def comp_method_OBJECT_ARRAY(op, x, y):
result = libops.vec_compare(x.ravel(), y.ravel(), op)
else:
result = libops.scalar_compare(x.ravel(), y, op)
result = np.where(isna(x), x, result)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the correct behavior; e.g. 5 = = np.nan should give False. We only want to change the behavior for pd.NA.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to make sure, only replace pd.NA is the intended behavior? so not to replace any of None, pd.NaT, np.nan?

If so, pd.isna() and np.isnan() both aren't gonna work. It seems only the Python is operator is capable to differentiate pd.NA with others. If there's another way to do this, please let me know. Much appreciated!

return result.reshape(x.shape)


Expand Down
Loading