diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index d7e77afe..85943841 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -246,7 +246,6 @@ class Series(IndexOpsMixin[S1], NDFrame): cls, data: npt.NDArray[np.float64], index: Axes | None = ..., - *, dtype: Dtype = ..., name: Hashable = ..., copy: bool = ..., @@ -256,7 +255,6 @@ class Series(IndexOpsMixin[S1], NDFrame): cls, data: Sequence[Never], index: Axes | None = ..., - *, dtype: Dtype = ..., name: Hashable = ..., copy: bool = ..., @@ -266,7 +264,6 @@ class Series(IndexOpsMixin[S1], NDFrame): cls, data: Sequence[list[str]], index: Axes | None = ..., - *, dtype: Dtype = ..., name: Hashable = ..., copy: bool = ..., @@ -276,7 +273,6 @@ class Series(IndexOpsMixin[S1], NDFrame): cls, data: Sequence[str], index: Axes | None = ..., - *, dtype: Dtype = ..., name: Hashable = ..., copy: bool = ..., @@ -293,7 +289,6 @@ class Series(IndexOpsMixin[S1], NDFrame): | date ), index: Axes | None = ..., - *, dtype: TimestampDtypeArg = ..., name: Hashable = ..., copy: bool = ..., @@ -313,7 +308,6 @@ class Series(IndexOpsMixin[S1], NDFrame): cls, data: PeriodIndex | Sequence[Period], index: Axes | None = ..., - *, dtype: PeriodDtype = ..., name: Hashable = ..., copy: bool = ..., @@ -329,7 +323,6 @@ class Series(IndexOpsMixin[S1], NDFrame): | timedelta ), index: Axes | None = ..., - *, dtype: TimedeltaDtypeArg = ..., name: Hashable = ..., copy: bool = ..., @@ -344,7 +337,6 @@ class Series(IndexOpsMixin[S1], NDFrame): | dict[HashableT1, Interval[_OrderableT]] ), index: Axes | None = ..., - *, dtype: Literal["Interval"] = ..., name: Hashable = ..., copy: bool = ..., @@ -364,7 +356,6 @@ class Series(IndexOpsMixin[S1], NDFrame): cls, data: Sequence[bool], index: Axes | None = ..., - *, dtype: Dtype = ..., name: Hashable = ..., copy: bool = ..., @@ -374,7 +365,6 @@ class Series(IndexOpsMixin[S1], NDFrame): cls, data: Sequence[int], index: Axes | None = ..., - *, dtype: Dtype = ..., name: Hashable = ..., copy: bool = ..., @@ -384,7 +374,6 @@ class Series(IndexOpsMixin[S1], NDFrame): cls, data: Sequence[float], index: Axes | None = ..., - *, dtype: Dtype = ..., name: Hashable = ..., copy: bool = ..., @@ -394,7 +383,6 @@ class Series(IndexOpsMixin[S1], NDFrame): cls, data: Sequence[int | float], index: Axes | None = ..., - *, dtype: Dtype = ..., name: Hashable = ..., copy: bool = ..., @@ -404,7 +392,6 @@ class Series(IndexOpsMixin[S1], NDFrame): cls, data: S1 | _ListLike[S1] | dict[HashableT1, S1] | dict_keys[S1, Any], index: Axes | None = ..., - *, dtype: Dtype = ..., name: Hashable = ..., copy: bool = ..., @@ -422,7 +409,6 @@ class Series(IndexOpsMixin[S1], NDFrame): | None ) = ..., index: Axes | None = ..., - *, dtype: Dtype = ..., name: Hashable = ..., copy: bool = ..., diff --git a/tests/test_series.py b/tests/test_series.py index cc79d61d..9edc8e06 100644 --- a/tests/test_series.py +++ b/tests/test_series.py @@ -136,6 +136,18 @@ def test_types_init() -> None: pd.Series(data=groupby) pd.Series(data=resampler) + pd.Series([], pd.DatetimeIndex([]), float, "name") + check( + assert_type(pd.Series([1.0], pd.DatetimeIndex([1]), float), "pd.Series[float]"), + pd.Series, + float, + ) + check( + assert_type(pd.Series([1.0], pd.Index([1]), float, "f"), "pd.Series[float]"), + pd.Series, + float, + ) + def test_types_any() -> None: check(assert_type(pd.Series([False, False]).any(), np.bool), np.bool)