Skip to content

Commit 25a9d35

Browse files
committed
BooleanArray does not support pd.NaT
1 parent 8c3050c commit 25a9d35

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pandas/_libs/lib.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1784,7 +1784,7 @@ cdef class Validator:
17841784
"must define is_value_typed")
17851785

17861786
cdef bint is_valid_null(self, object value) except -1:
1787-
return value is None or value is C_NA or util.is_nan(value) or value is NaT
1787+
return value is None or value is C_NA or util.is_nan(value)
17881788
# TODO: include decimal NA?
17891789

17901790
cdef bint is_array_typed(self) except -1:

pandas/tests/dtypes/test_inference.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,8 +944,9 @@ def test_maybe_convert_objects_nullable_boolean(self):
944944
out = lib.maybe_convert_objects(arr, convert_to_nullable_dtype=True)
945945
tm.assert_extension_array_equal(out, exp)
946946

947-
arr = np.array([True, False, pd.NaT], dtype=object)
948-
exp = BooleanArray._from_sequence([True, False, pd.NaT], dtype="boolean")
947+
# pd.NaT are not supported in BooleanArray, but pd.NA are supported
948+
arr = np.array([True, False, pd.NA], dtype=object)
949+
exp = BooleanArray._from_sequence([True, False, pd.NA], dtype="boolean")
949950
out = lib.maybe_convert_objects(arr, convert_to_nullable_dtype=True)
950951
tm.assert_extension_array_equal(out, exp)
951952

0 commit comments

Comments
 (0)