Skip to content

Commit 7bbc88b

Browse files
committed
take into account NaT value
1 parent 04df901 commit 7bbc88b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pandas/_libs/lib.pyx

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

17921792
cdef bint is_valid_null(self, object value) except -1:
1793-
return value is None or value is C_NA or util.is_nan(value)
1793+
return value is None or value is C_NA or util.is_nan(value) or value is NaT
17941794
# TODO: include decimal NA?
17951795

17961796
cdef bint is_array_typed(self) except -1:

pandas/tests/dtypes/test_inference.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,9 +945,9 @@ def test_maybe_convert_objects_nullable_boolean(self):
945945
tm.assert_extension_array_equal(out, exp)
946946

947947
arr = np.array([True, False, pd.NaT], dtype=object)
948-
exp = np.array([True, False, pd.NaT], dtype=object)
948+
exp = BooleanArray._from_sequence([True, False, pd.NaT], dtype="boolean")
949949
out = lib.maybe_convert_objects(arr, convert_to_nullable_dtype=True)
950-
tm.assert_numpy_array_equal(out, exp)
950+
tm.assert_extension_array_equal(out, exp)
951951

952952
@pytest.mark.parametrize("val", [None, np.nan])
953953
def test_maybe_convert_objects_nullable_boolean_na(self, val):

0 commit comments

Comments
 (0)