Skip to content

Commit 37d232b

Browse files
committed
simplify
1 parent d5a070a commit 37d232b

File tree

3 files changed

+42
-63
lines changed

3 files changed

+42
-63
lines changed

pandas-stubs/core/frame.pyi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ from pandas.core.reshape.pivot import (
5151
)
5252
from pandas.core.series import (
5353
Series,
54-
UnknownSeries,
5554
)
5655
from pandas.core.window import (
5756
Expanding,
@@ -2010,7 +2009,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
20102009
| Callable[[DataFrame], DataFrame]
20112010
| Callable[[Any], _bool]
20122011
),
2013-
other: Scalar | UnknownSeries | DataFrame | Callable | NAType | None = ...,
2012+
other: Scalar | Series | DataFrame | Callable | NAType | None = ...,
20142013
*,
20152014
inplace: Literal[True],
20162015
axis: Axis | None = ...,
@@ -2026,7 +2025,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
20262025
| Callable[[DataFrame], DataFrame]
20272026
| Callable[[Any], _bool]
20282027
),
2029-
other: Scalar | UnknownSeries | DataFrame | Callable | NAType | None = ...,
2028+
other: Scalar | Series | DataFrame | Callable | NAType | None = ...,
20302029
*,
20312030
inplace: Literal[False] = ...,
20322031
axis: Axis | None = ...,

pandas-stubs/core/generic.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ from pandas import Index
2020
import pandas.core.indexing as indexing
2121
from pandas.core.resample import DatetimeIndexResampler
2222
from pandas.core.series import (
23-
UnknownSeries,
23+
Series,
2424
)
2525
import sqlalchemy.engine
2626
from typing_extensions import (
@@ -82,7 +82,7 @@ class NDFrame(indexing.IndexingMixin):
8282
def ndim(self) -> int: ...
8383
@property
8484
def size(self) -> int: ...
85-
def equals(self, other: UnknownSeries) -> _bool: ...
85+
def equals(self, other: Series) -> _bool: ...
8686
def __neg__(self) -> Self: ...
8787
def __pos__(self) -> Self: ...
8888
def __nonzero__(self) -> None: ...

pandas-stubs/core/series.pyi

Lines changed: 38 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
264264
dtype: Dtype = ...,
265265
name: Hashable = ...,
266266
copy: bool = ...,
267-
) -> UnknownSeries: ...
267+
) -> Series: ...
268268
@overload
269269
def __new__(
270270
cls,
@@ -418,7 +418,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
418418
dtype: Dtype = ...,
419419
name: Hashable = ...,
420420
copy: bool = ...,
421-
) -> UnknownSeries: ...
421+
) -> Series: ...
422422
@property
423423
def hasnans(self) -> bool: ...
424424
def div(
@@ -731,7 +731,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
731731
@overload
732732
def groupby(
733733
self,
734-
by: CategoricalIndex | Index | UnknownSeries,
734+
by: CategoricalIndex | Index | Series,
735735
axis: AxisIndex = ...,
736736
level: IndexLabel | None = ...,
737737
as_index: _bool = ...,
@@ -814,15 +814,15 @@ class Series(IndexOpsMixin[S1], NDFrame):
814814
self, other: ArrayLike | dict[_str, np.ndarray] | Sequence[S1] | Index[S1]
815815
) -> np.ndarray: ...
816816
@overload
817-
def __matmul__(self, other: UnknownSeries) -> Scalar: ...
817+
def __matmul__(self, other: Series) -> Scalar: ...
818818
@overload
819-
def __matmul__(self, other: DataFrame) -> UnknownSeries: ...
819+
def __matmul__(self, other: DataFrame) -> Series: ...
820820
@overload
821821
def __matmul__(self, other: np.ndarray) -> np.ndarray: ...
822822
@overload
823-
def __rmatmul__(self, other: UnknownSeries) -> Scalar: ...
823+
def __rmatmul__(self, other: Series) -> Scalar: ...
824824
@overload
825-
def __rmatmul__(self, other: DataFrame) -> UnknownSeries: ...
825+
def __rmatmul__(self, other: DataFrame) -> Series: ...
826826
@overload
827827
def __rmatmul__(self, other: np.ndarray) -> np.ndarray: ...
828828
@overload
@@ -842,16 +842,16 @@ class Series(IndexOpsMixin[S1], NDFrame):
842842
@overload
843843
def compare(
844844
self,
845-
other: UnknownSeries,
845+
other: Series,
846846
align_axis: AxisIndex,
847847
keep_shape: bool = ...,
848848
keep_equal: bool = ...,
849849
result_names: Suffixes = ...,
850-
) -> UnknownSeries: ...
850+
) -> Series: ...
851851
@overload
852852
def compare(
853853
self,
854-
other: UnknownSeries,
854+
other: Series,
855855
align_axis: AxisColumn = ...,
856856
keep_shape: bool = ...,
857857
keep_equal: bool = ...,
@@ -951,9 +951,9 @@ class Series(IndexOpsMixin[S1], NDFrame):
951951
@overload
952952
def map(
953953
self,
954-
arg: Callable[[Any], Any] | Mapping[Any, Any] | UnknownSeries,
954+
arg: Callable[[Any], Any] | Mapping[Any, Any] | Series,
955955
na_action: Literal["ignore"] | None = ...,
956-
) -> UnknownSeries: ...
956+
) -> Series: ...
957957
@overload
958958
def aggregate(
959959
self: Series[int],
@@ -977,7 +977,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
977977
axis: AxisIndex = ...,
978978
*args: Any,
979979
**kwargs: Any,
980-
) -> UnknownSeries: ...
980+
) -> Series: ...
981981
agg = aggregate
982982
@overload
983983
def transform(
@@ -1004,7 +1004,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
10041004
convertDType: _bool = ...,
10051005
args: tuple = ...,
10061006
**kwargs: Any,
1007-
) -> UnknownSeries: ...
1007+
) -> Series: ...
10081008
@overload
10091009
def apply(
10101010
self,
@@ -1016,20 +1016,20 @@ class Series(IndexOpsMixin[S1], NDFrame):
10161016
@overload
10171017
def apply(
10181018
self,
1019-
func: Callable[..., UnknownSeries],
1019+
func: Callable[..., Series],
10201020
convertDType: _bool = ...,
10211021
args: tuple = ...,
10221022
**kwargs: Any,
10231023
) -> DataFrame: ...
10241024
def align(
10251025
self,
1026-
other: DataFrame | UnknownSeries,
1026+
other: DataFrame | Series,
10271027
join: JoinHow = ...,
10281028
axis: Axis | None = ...,
10291029
level: Level | None = ...,
10301030
copy: _bool = ...,
10311031
fill_value: Scalar | NAType | None = ...,
1032-
) -> tuple[UnknownSeries, UnknownSeries]: ...
1032+
) -> tuple[Series, Series]: ...
10331033
@overload
10341034
def rename(
10351035
self,
@@ -1124,7 +1124,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
11241124
freq: DateOffset | timedelta | _str | None = ...,
11251125
axis: Axis = ...,
11261126
fill_value: Scalar | NAType | None = ...,
1127-
) -> UnknownSeries: ...
1127+
) -> Series: ...
11281128
def info(
11291129
self,
11301130
verbose: bool | None = ...,
@@ -1507,15 +1507,11 @@ class Series(IndexOpsMixin[S1], NDFrame):
15071507
tuple[
15081508
Sequence[bool]
15091509
| Series[bool]
1510-
| Callable[
1511-
[UnknownSeries], UnknownSeries | np.ndarray | Sequence[bool]
1512-
],
1513-
ListLikeU
1514-
| Scalar
1515-
| Callable[[UnknownSeries], UnknownSeries | np.ndarray],
1510+
| Callable[[Series], Series | np.ndarray | Sequence[bool]],
1511+
ListLikeU | Scalar | Callable[[Series], Series | np.ndarray],
15161512
],
15171513
],
1518-
) -> UnknownSeries: ...
1514+
) -> Series: ...
15191515
def truncate(
15201516
self,
15211517
before: date | _str | int | None = ...,
@@ -1586,16 +1582,8 @@ class Series(IndexOpsMixin[S1], NDFrame):
15861582
@overload
15871583
def __add__(
15881584
self,
1589-
other: (
1590-
num
1591-
| _str
1592-
| timedelta
1593-
| Timedelta
1594-
| _ListLike
1595-
| UnknownSeries
1596-
| np.timedelta64
1597-
),
1598-
) -> UnknownSeries: ...
1585+
other: num | _str | timedelta | Timedelta | _ListLike | Series | np.timedelta64,
1586+
) -> Series: ...
15991587
# ignore needed for mypy as we want different results based on the arguments
16001588
@overload # type: ignore[override]
16011589
def __and__( # pyright: ignore[reportOverlappingOverload]
@@ -1624,7 +1612,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
16241612
self, other: timedelta | Timedelta | TimedeltaSeries | np.timedelta64
16251613
) -> TimedeltaSeries: ...
16261614
@overload
1627-
def __mul__(self, other: num | _ListLike | UnknownSeries) -> UnknownSeries: ...
1615+
def __mul__(self, other: num | _ListLike | Series) -> Series: ...
16281616
def __mod__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
16291617
def __ne__(self, other: object) -> Series[_bool]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
16301618
def __pow__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
@@ -1638,9 +1626,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
16381626
@overload
16391627
def __radd__(self, other: S1 | Series[S1]) -> Self: ...
16401628
@overload
1641-
def __radd__(
1642-
self, other: num | _str | _ListLike | UnknownSeries
1643-
) -> UnknownSeries: ...
1629+
def __radd__(self, other: num | _str | _ListLike | Series) -> Series: ...
16441630
# ignore needed for mypy as we want different results based on the arguments
16451631
@overload # type: ignore[override]
16461632
def __rand__( # pyright: ignore[reportOverlappingOverload]
@@ -1657,7 +1643,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
16571643
self, other: timedelta | Timedelta | TimedeltaSeries | np.timedelta64
16581644
) -> TimedeltaSeries: ...
16591645
@overload
1660-
def __rmul__(self, other: num | _ListLike | UnknownSeries) -> UnknownSeries: ...
1646+
def __rmul__(self, other: num | _ListLike | Series) -> Series: ...
16611647
def __rnatmul__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
16621648
def __rpow__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
16631649
# ignore needed for mypy as we want different results based on the arguments
@@ -1667,10 +1653,8 @@ class Series(IndexOpsMixin[S1], NDFrame):
16671653
) -> Series[bool]: ...
16681654
@overload
16691655
def __ror__(self, other: int | np_ndarray_anyint | Series[int]) -> Series[int]: ...
1670-
def __rsub__(self, other: num | _ListLike | Series[S1]) -> UnknownSeries: ...
1671-
def __rtruediv__(
1672-
self, other: num | _ListLike | Series[S1] | Path
1673-
) -> UnknownSeries: ...
1656+
def __rsub__(self, other: num | _ListLike | Series[S1]) -> Series: ...
1657+
def __rtruediv__(self, other: num | _ListLike | Series[S1] | Path) -> Series: ...
16741658
# ignore needed for mypy as we want different results based on the arguments
16751659
@overload # type: ignore[override]
16761660
def __rxor__( # pyright: ignore[reportOverlappingOverload]
@@ -1693,10 +1677,8 @@ class Series(IndexOpsMixin[S1], NDFrame):
16931677
self, other: Timestamp | datetime | TimestampSeries
16941678
) -> TimedeltaSeries: ...
16951679
@overload
1696-
def __sub__(self, other: num | _ListLike | UnknownSeries) -> UnknownSeries: ...
1697-
def __truediv__(
1698-
self, other: num | _ListLike | Series[S1] | Path
1699-
) -> UnknownSeries: ...
1680+
def __sub__(self, other: num | _ListLike | Series) -> Series: ...
1681+
def __truediv__(self, other: num | _ListLike | Series[S1] | Path) -> Series: ...
17001682
# ignore needed for mypy as we want different results based on the arguments
17011683
@overload # type: ignore[override]
17021684
def __xor__( # pyright: ignore[reportOverlappingOverload]
@@ -1799,12 +1781,12 @@ class Series(IndexOpsMixin[S1], NDFrame):
17991781
min_periods: int = ...,
18001782
adjust: _bool = ...,
18011783
ignore_na: _bool = ...,
1802-
) -> ExponentialMovingWindow[UnknownSeries]: ...
1784+
) -> ExponentialMovingWindow[Series]: ...
18031785
def expanding(
18041786
self,
18051787
min_periods: int = ...,
18061788
method: CalculationMethod = ...,
1807-
) -> Expanding[UnknownSeries]: ...
1789+
) -> Expanding[Series]: ...
18081790
def floordiv(
18091791
self,
18101792
other: num | _ListLike | Series[S1],
@@ -1907,11 +1889,11 @@ class Series(IndexOpsMixin[S1], NDFrame):
19071889
@overload
19081890
def mul(
19091891
self,
1910-
other: num | _ListLike | UnknownSeries,
1892+
other: num | _ListLike | Series,
19111893
level: Level | None = ...,
19121894
fill_value: float | None = ...,
19131895
axis: AxisIndex | None = ...,
1914-
) -> UnknownSeries: ...
1896+
) -> Series: ...
19151897
def multiply(
19161898
self,
19171899
other: num | _ListLike | Series[S1],
@@ -1991,11 +1973,11 @@ class Series(IndexOpsMixin[S1], NDFrame):
19911973
@overload
19921974
def rmul(
19931975
self,
1994-
other: num | _ListLike | UnknownSeries,
1976+
other: num | _ListLike | Series,
19951977
level: Level | None = ...,
19961978
fill_value: float | None = ...,
19971979
axis: AxisIndex = ...,
1998-
) -> UnknownSeries: ...
1980+
) -> Series: ...
19991981
@overload
20001982
def rolling(
20011983
self,
@@ -2008,7 +1990,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
20081990
method: CalculationMethod = ...,
20091991
*,
20101992
win_type: _str,
2011-
) -> Window[UnknownSeries]: ...
1993+
) -> Window[Series]: ...
20121994
@overload
20131995
def rolling(
20141996
self,
@@ -2021,7 +2003,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
20212003
method: CalculationMethod = ...,
20222004
*,
20232005
win_type: None = ...,
2024-
) -> Rolling[UnknownSeries]: ...
2006+
) -> Rolling[Series]: ...
20252007
def rpow(
20262008
self,
20272009
other: Series[S1] | Scalar,
@@ -2352,5 +2334,3 @@ class IntervalSeries(Series[Interval[_OrderableT]], Generic[_OrderableT]):
23522334
@property
23532335
def array(self) -> IntervalArray: ...
23542336
def diff(self, periods: int = ...) -> Never: ...
2355-
2356-
UnknownSeries: TypeAlias = Series

0 commit comments

Comments
 (0)