Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions pandas-stubs/core/series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: npt.NDArray[np.float64],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -256,7 +255,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: Sequence[Never],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -266,7 +264,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: Sequence[list[str]],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -276,7 +273,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: Sequence[str],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -293,7 +289,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
| date
),
index: Axes | None = ...,
*,
dtype: TimestampDtypeArg = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -303,8 +298,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: _ListLike,
index: Axes | None = ...,
*,
dtype: TimestampDtypeArg,
dtype: TimestampDtypeArg = ...,
name: Hashable = ...,
copy: bool = ...,
) -> TimestampSeries: ...
Expand All @@ -313,7 +307,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: PeriodIndex | Sequence[Period],
index: Axes | None = ...,
*,
dtype: PeriodDtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -329,7 +322,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
| timedelta
),
index: Axes | None = ...,
*,
dtype: TimedeltaDtypeArg = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -344,7 +336,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
| dict[HashableT1, Interval[_OrderableT]]
),
index: Axes | None = ...,
*,
dtype: Literal["Interval"] = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -354,8 +345,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: Scalar | _ListLike | dict[HashableT1, Any] | None,
index: Axes | None = ...,
*,
dtype: type[S1],
dtype: type[S1] = ...,
name: Hashable = ...,
copy: bool = ...,
) -> Self: ...
Expand All @@ -364,7 +354,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: Sequence[bool],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -374,7 +363,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: Sequence[int],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -384,7 +372,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: Sequence[float],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -394,7 +381,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: Sequence[int | float],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -404,7 +390,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 = ...,
Expand All @@ -422,7 +407,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
| None
) = ...,
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand Down
13 changes: 13 additions & 0 deletions tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,19 @@ def test_types_init() -> None:
pd.Series(data=groupby)
pd.Series(data=resampler)

check(
assert_type(pd.Series([1], pd.Index([1]), float), "pd.Series[float]"),
pd.Series,
float,
)
check(
assert_type(
pd.Series([1], pd.DatetimeIndex([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)
Expand Down
Loading