diff --git a/pandas/core/construction.py b/pandas/core/construction.py index 17cdf6665aa99..a3f71cc18454e 100644 --- a/pandas/core/construction.py +++ b/pandas/core/construction.py @@ -52,6 +52,7 @@ ) from pandas.core.dtypes.dtypes import ( DatetimeTZDtype, + IntervalDtype, PandasDtype, ) from pandas.core.dtypes.generic import ( @@ -774,6 +775,9 @@ def _try_cast( return maybe_cast_to_datetime(arr, dtype) # TODO: copy? + if isinstance(dtype, IntervalDtype) and isna(arr).all(): + return np.asarray(arr).astype(IntervalDtype, copy=False) + array_type = dtype.construct_array_type()._from_sequence subarr = array_type(arr, dtype=dtype, copy=copy) return subarr diff --git a/pandas/tests/series/test_constructors.py b/pandas/tests/series/test_constructors.py index 3b7ae28be68fa..57cb8be236068 100644 --- a/pandas/tests/series/test_constructors.py +++ b/pandas/tests/series/test_constructors.py @@ -1995,3 +1995,11 @@ def test_numpy_array(input_dict, expected): def test_numpy_array_np_v1p19(): with pytest.raises(KeyError, match="0"): np.array([Series({1: 1})]) + + +def test_series_with_NAs_and_interval_of_datetime_dtype(): + # GH#41805 + result = Series(data=[None], dtype="interval[datetime64[ns]]") + expected = Series(np.nan, dtype="interval[datetime64[ns]]") + + tm.assert_series_equal(result, expected)