Skip to content

Commit 13c5d72

Browse files
committed
BUG: Another issue with maybe_convert_objects (GH #2845)
1 parent 0491971 commit 13c5d72

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

pandas/src/inference.pyx

+12-10
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,11 @@ def maybe_convert_objects(ndarray[object] objects, bint try_float=0,
478478

479479
if not safe:
480480
if seen_null:
481-
if seen_complex:
482-
return complexes
483-
elif seen_float or seen_int:
484-
return floats
481+
if not seen_bool and not seen_datetime:
482+
if seen_complex:
483+
return complexes
484+
elif seen_float or seen_int:
485+
return floats
485486
else:
486487
if not seen_bool:
487488
if seen_datetime:
@@ -500,12 +501,13 @@ def maybe_convert_objects(ndarray[object] objects, bint try_float=0,
500501
else:
501502
# don't cast int to float, etc.
502503
if seen_null:
503-
if seen_complex:
504-
if not seen_int:
505-
return complexes
506-
elif seen_float:
507-
if not seen_int:
508-
return floats
504+
if not seen_bool and not seen_datetime:
505+
if seen_complex:
506+
if not seen_int:
507+
return complexes
508+
elif seen_float:
509+
if not seen_int:
510+
return floats
509511
else:
510512
if not seen_bool:
511513
if seen_datetime:

0 commit comments

Comments
 (0)