Skip to content

Commit 5cac358

Browse files
committed
1 parent d8a8a73 commit 5cac358

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

pandas-stubs/core/series.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,9 @@ class Series(IndexOpsMixin[S1], NDFrame):
297297
def __new__(
298298
cls,
299299
data: _ListLike,
300+
dtype: TimestampDtypeArg,
301+
*,
300302
index: Axes | None = ...,
301-
dtype: TimestampDtypeArg = ...,
302303
name: Hashable = ...,
303304
copy: bool = ...,
304305
) -> TimestampSeries: ...
@@ -344,8 +345,9 @@ class Series(IndexOpsMixin[S1], NDFrame):
344345
def __new__( # type: ignore[overload-overlap]
345346
cls,
346347
data: Scalar | _ListLike | dict[HashableT1, Any] | None,
348+
dtype: type[S1],
349+
*,
347350
index: Axes | None = ...,
348-
dtype: type[S1] = ...,
349351
name: Hashable = ...,
350352
copy: bool = ...,
351353
) -> Self: ...

tests/test_series.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,14 @@ def test_types_init() -> None:
136136
pd.Series(data=groupby)
137137
pd.Series(data=resampler)
138138

139+
pd.Series([], pd.DatetimeIndex([]), float, "name")
139140
check(
140-
assert_type(pd.Series([1], pd.Index([1]), float), "pd.Series[float]"),
141+
assert_type(pd.Series([1.0], pd.DatetimeIndex([1]), float), "pd.Series[float]"),
141142
pd.Series,
142143
float,
143144
)
144145
check(
145-
assert_type(
146-
pd.Series([1], pd.DatetimeIndex([1]), float, "f"), "pd.Series[float]"
147-
),
146+
assert_type(pd.Series([1.0], pd.Index([1]), float, "f"), "pd.Series[float]"),
148147
pd.Series,
149148
float,
150149
)

0 commit comments

Comments
 (0)