Skip to content

Commit cb1a5c6

Browse files
committed
remove UnknownSeries
1 parent 579db3c commit cb1a5c6

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
@@ -52,7 +52,6 @@ from pandas.core.reshape.pivot import (
5252
)
5353
from pandas.core.series import (
5454
Series,
55-
UnknownSeries,
5655
)
5756
from pandas.core.window import (
5857
Expanding,
@@ -2011,7 +2010,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
20112010
| Callable[[DataFrame], DataFrame]
20122011
| Callable[[Any], _bool]
20132012
),
2014-
other: Scalar | UnknownSeries | DataFrame | Callable | NAType | None = ...,
2013+
other: Scalar | Series | DataFrame | Callable | NAType | None = ...,
20152014
*,
20162015
inplace: Literal[True],
20172016
axis: Axis | None = ...,
@@ -2027,7 +2026,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
20272026
| Callable[[DataFrame], DataFrame]
20282027
| Callable[[Any], _bool]
20292028
),
2030-
other: Scalar | UnknownSeries | DataFrame | Callable | NAType | None = ...,
2029+
other: Scalar | Series | DataFrame | Callable | NAType | None = ...,
20312030
*,
20322031
inplace: Literal[False] = ...,
20332032
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
@@ -265,7 +265,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
265265
dtype: Dtype = ...,
266266
name: Hashable = ...,
267267
copy: bool = ...,
268-
) -> UnknownSeries: ...
268+
) -> Series: ...
269269
@overload
270270
def __new__(
271271
cls,
@@ -419,7 +419,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
419419
dtype: Dtype = ...,
420420
name: Hashable = ...,
421421
copy: bool = ...,
422-
) -> UnknownSeries: ...
422+
) -> Series: ...
423423
@property
424424
def hasnans(self) -> bool: ...
425425
def div(
@@ -732,7 +732,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
732732
@overload
733733
def groupby(
734734
self,
735-
by: CategoricalIndex | UnknownIndex | UnknownSeries,
735+
by: CategoricalIndex | UnknownIndex | Series,
736736
axis: AxisIndex = ...,
737737
level: IndexLabel | None = ...,
738738
as_index: _bool = ...,
@@ -815,15 +815,15 @@ class Series(IndexOpsMixin[S1], NDFrame):
815815
self, other: ArrayLike | dict[_str, np.ndarray] | Sequence[S1] | Index[S1]
816816
) -> np.ndarray: ...
817817
@overload
818-
def __matmul__(self, other: UnknownSeries) -> Scalar: ...
818+
def __matmul__(self, other: Series) -> Scalar: ...
819819
@overload
820-
def __matmul__(self, other: DataFrame) -> UnknownSeries: ...
820+
def __matmul__(self, other: DataFrame) -> Series: ...
821821
@overload
822822
def __matmul__(self, other: np.ndarray) -> np.ndarray: ...
823823
@overload
824-
def __rmatmul__(self, other: UnknownSeries) -> Scalar: ...
824+
def __rmatmul__(self, other: Series) -> Scalar: ...
825825
@overload
826-
def __rmatmul__(self, other: DataFrame) -> UnknownSeries: ...
826+
def __rmatmul__(self, other: DataFrame) -> Series: ...
827827
@overload
828828
def __rmatmul__(self, other: np.ndarray) -> np.ndarray: ...
829829
@overload
@@ -843,16 +843,16 @@ class Series(IndexOpsMixin[S1], NDFrame):
843843
@overload
844844
def compare(
845845
self,
846-
other: UnknownSeries,
846+
other: Series,
847847
align_axis: AxisIndex,
848848
keep_shape: bool = ...,
849849
keep_equal: bool = ...,
850850
result_names: Suffixes = ...,
851-
) -> UnknownSeries: ...
851+
) -> Series: ...
852852
@overload
853853
def compare(
854854
self,
855-
other: UnknownSeries,
855+
other: Series,
856856
align_axis: AxisColumn = ...,
857857
keep_shape: bool = ...,
858858
keep_equal: bool = ...,
@@ -952,9 +952,9 @@ class Series(IndexOpsMixin[S1], NDFrame):
952952
@overload
953953
def map(
954954
self,
955-
arg: Callable[[Any], Any] | Mapping[Any, Any] | UnknownSeries,
955+
arg: Callable[[Any], Any] | Mapping[Any, Any] | Series,
956956
na_action: Literal["ignore"] | None = ...,
957-
) -> UnknownSeries: ...
957+
) -> Series: ...
958958
@overload
959959
def aggregate(
960960
self: Series[int],
@@ -978,7 +978,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
978978
axis: AxisIndex = ...,
979979
*args: Any,
980980
**kwargs: Any,
981-
) -> UnknownSeries: ...
981+
) -> Series: ...
982982
agg = aggregate
983983
@overload
984984
def transform(
@@ -1005,7 +1005,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
10051005
convertDType: _bool = ...,
10061006
args: tuple = ...,
10071007
**kwargs: Any,
1008-
) -> UnknownSeries: ...
1008+
) -> Series: ...
10091009
@overload
10101010
def apply(
10111011
self,
@@ -1017,20 +1017,20 @@ class Series(IndexOpsMixin[S1], NDFrame):
10171017
@overload
10181018
def apply(
10191019
self,
1020-
func: Callable[..., UnknownSeries],
1020+
func: Callable[..., Series],
10211021
convertDType: _bool = ...,
10221022
args: tuple = ...,
10231023
**kwargs: Any,
10241024
) -> DataFrame: ...
10251025
def align(
10261026
self,
1027-
other: DataFrame | UnknownSeries,
1027+
other: DataFrame | Series,
10281028
join: JoinHow = ...,
10291029
axis: Axis | None = ...,
10301030
level: Level | None = ...,
10311031
copy: _bool = ...,
10321032
fill_value: Scalar | NAType | None = ...,
1033-
) -> tuple[UnknownSeries, UnknownSeries]: ...
1033+
) -> tuple[Series, Series]: ...
10341034
@overload
10351035
def rename(
10361036
self,
@@ -1125,7 +1125,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
11251125
freq: DateOffset | timedelta | _str | None = ...,
11261126
axis: Axis = ...,
11271127
fill_value: Scalar | NAType | None = ...,
1128-
) -> UnknownSeries: ...
1128+
) -> Series: ...
11291129
def info(
11301130
self,
11311131
verbose: bool | None = ...,
@@ -1508,15 +1508,11 @@ class Series(IndexOpsMixin[S1], NDFrame):
15081508
tuple[
15091509
Sequence[bool]
15101510
| Series[bool]
1511-
| Callable[
1512-
[UnknownSeries], UnknownSeries | np.ndarray | Sequence[bool]
1513-
],
1514-
ListLikeU
1515-
| Scalar
1516-
| Callable[[UnknownSeries], UnknownSeries | np.ndarray],
1511+
| Callable[[Series], Series | np.ndarray | Sequence[bool]],
1512+
ListLikeU | Scalar | Callable[[Series], Series | np.ndarray],
15171513
],
15181514
],
1519-
) -> UnknownSeries: ...
1515+
) -> Series: ...
15201516
def truncate(
15211517
self,
15221518
before: date | _str | int | None = ...,
@@ -1587,16 +1583,8 @@ class Series(IndexOpsMixin[S1], NDFrame):
15871583
@overload
15881584
def __add__(
15891585
self,
1590-
other: (
1591-
num
1592-
| _str
1593-
| timedelta
1594-
| Timedelta
1595-
| _ListLike
1596-
| UnknownSeries
1597-
| np.timedelta64
1598-
),
1599-
) -> UnknownSeries: ...
1586+
other: num | _str | timedelta | Timedelta | _ListLike | Series | np.timedelta64,
1587+
) -> Series: ...
16001588
# ignore needed for mypy as we want different results based on the arguments
16011589
@overload # type: ignore[override]
16021590
def __and__( # pyright: ignore[reportOverlappingOverload]
@@ -1625,7 +1613,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
16251613
self, other: timedelta | Timedelta | TimedeltaSeries | np.timedelta64
16261614
) -> TimedeltaSeries: ...
16271615
@overload
1628-
def __mul__(self, other: num | _ListLike | UnknownSeries) -> UnknownSeries: ...
1616+
def __mul__(self, other: num | _ListLike | Series) -> Series: ...
16291617
def __mod__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
16301618
def __ne__(self, other: object) -> Series[_bool]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
16311619
def __pow__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
@@ -1639,9 +1627,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
16391627
@overload
16401628
def __radd__(self, other: S1 | Series[S1]) -> Self: ...
16411629
@overload
1642-
def __radd__(
1643-
self, other: num | _str | _ListLike | UnknownSeries
1644-
) -> UnknownSeries: ...
1630+
def __radd__(self, other: num | _str | _ListLike | Series) -> Series: ...
16451631
# ignore needed for mypy as we want different results based on the arguments
16461632
@overload # type: ignore[override]
16471633
def __rand__( # pyright: ignore[reportOverlappingOverload]
@@ -1658,7 +1644,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
16581644
self, other: timedelta | Timedelta | TimedeltaSeries | np.timedelta64
16591645
) -> TimedeltaSeries: ...
16601646
@overload
1661-
def __rmul__(self, other: num | _ListLike | UnknownSeries) -> UnknownSeries: ...
1647+
def __rmul__(self, other: num | _ListLike | Series) -> Series: ...
16621648
def __rnatmul__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
16631649
def __rpow__(self, other: num | _ListLike | Series[S1]) -> Series[S1]: ...
16641650
# ignore needed for mypy as we want different results based on the arguments
@@ -1668,10 +1654,8 @@ class Series(IndexOpsMixin[S1], NDFrame):
16681654
) -> Series[bool]: ...
16691655
@overload
16701656
def __ror__(self, other: int | np_ndarray_anyint | Series[int]) -> Series[int]: ...
1671-
def __rsub__(self, other: num | _ListLike | Series[S1]) -> UnknownSeries: ...
1672-
def __rtruediv__(
1673-
self, other: num | _ListLike | Series[S1] | Path
1674-
) -> UnknownSeries: ...
1657+
def __rsub__(self, other: num | _ListLike | Series[S1]) -> Series: ...
1658+
def __rtruediv__(self, other: num | _ListLike | Series[S1] | Path) -> Series: ...
16751659
# ignore needed for mypy as we want different results based on the arguments
16761660
@overload # type: ignore[override]
16771661
def __rxor__( # pyright: ignore[reportOverlappingOverload]
@@ -1694,10 +1678,8 @@ class Series(IndexOpsMixin[S1], NDFrame):
16941678
self, other: Timestamp | datetime | TimestampSeries
16951679
) -> TimedeltaSeries: ...
16961680
@overload
1697-
def __sub__(self, other: num | _ListLike | UnknownSeries) -> UnknownSeries: ...
1698-
def __truediv__(
1699-
self, other: num | _ListLike | Series[S1] | Path
1700-
) -> UnknownSeries: ...
1681+
def __sub__(self, other: num | _ListLike | Series) -> Series: ...
1682+
def __truediv__(self, other: num | _ListLike | Series[S1] | Path) -> Series: ...
17011683
# ignore needed for mypy as we want different results based on the arguments
17021684
@overload # type: ignore[override]
17031685
def __xor__( # pyright: ignore[reportOverlappingOverload]
@@ -1800,12 +1782,12 @@ class Series(IndexOpsMixin[S1], NDFrame):
18001782
min_periods: int = ...,
18011783
adjust: _bool = ...,
18021784
ignore_na: _bool = ...,
1803-
) -> ExponentialMovingWindow[UnknownSeries]: ...
1785+
) -> ExponentialMovingWindow[Series]: ...
18041786
def expanding(
18051787
self,
18061788
min_periods: int = ...,
18071789
method: CalculationMethod = ...,
1808-
) -> Expanding[UnknownSeries]: ...
1790+
) -> Expanding[Series]: ...
18091791
def floordiv(
18101792
self,
18111793
other: num | _ListLike | Series[S1],
@@ -1908,11 +1890,11 @@ class Series(IndexOpsMixin[S1], NDFrame):
19081890
@overload
19091891
def mul(
19101892
self,
1911-
other: num | _ListLike | UnknownSeries,
1893+
other: num | _ListLike | Series,
19121894
level: Level | None = ...,
19131895
fill_value: float | None = ...,
19141896
axis: AxisIndex | None = ...,
1915-
) -> UnknownSeries: ...
1897+
) -> Series: ...
19161898
def multiply(
19171899
self,
19181900
other: num | _ListLike | Series[S1],
@@ -1992,11 +1974,11 @@ class Series(IndexOpsMixin[S1], NDFrame):
19921974
@overload
19931975
def rmul(
19941976
self,
1995-
other: num | _ListLike | UnknownSeries,
1977+
other: num | _ListLike | Series,
19961978
level: Level | None = ...,
19971979
fill_value: float | None = ...,
19981980
axis: AxisIndex = ...,
1999-
) -> UnknownSeries: ...
1981+
) -> Series: ...
20001982
@overload
20011983
def rolling(
20021984
self,
@@ -2009,7 +1991,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
20091991
method: CalculationMethod = ...,
20101992
*,
20111993
win_type: _str,
2012-
) -> Window[UnknownSeries]: ...
1994+
) -> Window[Series]: ...
20131995
@overload
20141996
def rolling(
20151997
self,
@@ -2022,7 +2004,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
20222004
method: CalculationMethod = ...,
20232005
*,
20242006
win_type: None = ...,
2025-
) -> Rolling[UnknownSeries]: ...
2007+
) -> Rolling[Series]: ...
20262008
def rpow(
20272009
self,
20282010
other: Series[S1] | Scalar,
@@ -2353,5 +2335,3 @@ class IntervalSeries(Series[Interval[_OrderableT]], Generic[_OrderableT]):
23532335
@property
23542336
def array(self) -> IntervalArray: ...
23552337
def diff(self, periods: int = ...) -> Never: ...
2356-
2357-
UnknownSeries: TypeAlias = Series[Any]

0 commit comments

Comments
 (0)