diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 24bac1a11..9218b674d 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -334,7 +334,7 @@ class Series(IndexOpsMixin[S1], NDFrame): data: ( Scalar | _ListLike - | dict[HashableT1, Any] + | Mapping[HashableT1, Any] | BaseGroupBy | NaTType | NAType diff --git a/tests/test_frame.py b/tests/test_frame.py index 3e09e7b3c..641989520 100644 --- a/tests/test_frame.py +++ b/tests/test_frame.py @@ -3490,3 +3490,15 @@ def test_info() -> None: check(assert_type(df.info(show_counts=True), None), type(None)) check(assert_type(df.info(show_counts=False), None), type(None)) check(assert_type(df.info(show_counts=None), None), type(None)) + + +def test_series_typed_dict() -> None: + """Test that no error is raised when constructing a series from a typed dict.""" + + class MyDict(TypedDict): + a: str + b: str + + my_dict = MyDict(a="", b="") + sr = pd.Series(my_dict) + check(assert_type(sr, pd.Series), pd.Series)