Skip to content

fix: Series initialiser also takes positional arguments #1207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 0 additions & 14 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 @@ -313,7 +308,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: PeriodIndex | Sequence[Period],
index: Axes | None = ...,
*,
dtype: PeriodDtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -329,7 +323,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
| timedelta
),
index: Axes | None = ...,
*,
dtype: TimedeltaDtypeArg = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -344,7 +337,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
| dict[HashableT1, Interval[_OrderableT]]
),
index: Axes | None = ...,
*,
dtype: Literal["Interval"] = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -364,7 +356,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: Sequence[bool],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -374,7 +365,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: Sequence[int],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -384,7 +374,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: Sequence[float],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -394,7 +383,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
cls,
data: Sequence[int | float],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand All @@ -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 = ...,
Expand All @@ -422,7 +409,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
| None
) = ...,
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
Expand Down
12 changes: 12 additions & 0 deletions tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down