Skip to content

Commit 6207cb9

Browse files
committed
added forgotten check for float NaN
1 parent 4d92e6a commit 6207cb9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/_libs/lib.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2363,13 +2363,15 @@ cdef inline void convert_and_set_item(object item, Py_ssize_t index,
23632363
bint keep_trivial_numbers):
23642364
cdef:
23652365
bint do_convert = 1
2366+
double double_item
23662367

23672368
if keep_trivial_numbers:
23682369
if isinstance(item, int) and Py_SIZE(item) < 2:
23692370
if <int>item == 0:
23702371
do_convert = 0
23712372
elif isinstance(item, float):
2372-
if <double>item == 0.0:
2373+
double_item = item
2374+
if double_item == 0.0 or double_item != double_item:
23732375
do_convert = 0
23742376

23752377
if do_convert and not isinstance(item, (str, bytes)):

0 commit comments

Comments
 (0)