Skip to content

Commit 2be31fa

Browse files
committed
BUG: is_nan returns True for pd.NA (#31632)
1 parent 236f7e6 commit 2be31fa

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

pandas/_libs/missing.pyx

+1
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ class NAType(C_NAType):
347347
"""
348348

349349
_instance = None
350+
_typ = "<NA>"
350351

351352
def __new__(cls, *args, **kwargs):
352353
if NAType._instance is None:

pandas/_libs/tslibs/util.pxd

+2
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ cdef inline bint is_nan(object val):
215215
if is_float_object(val):
216216
fval = val
217217
return fval != fval
218+
if getattr(val, '_typ', None) == "<NA>": # TODO : Write in seperate function
219+
return True
218220
return is_complex_object(val) and val != val
219221

220222

0 commit comments

Comments
 (0)