Skip to content

Commit a8209bd

Browse files
GH1255 Initial commit
1 parent fe0c638 commit a8209bd

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

pandas-stubs/_typing.pyi

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
from builtins import (
2-
str,
3-
type as type_t,
4-
)
1+
from builtins import type as type_t
52
from collections.abc import (
63
Callable,
74
Hashable,
85
Iterator,
6+
KeysView,
97
Mapping,
108
MutableSequence,
119
Sequence,
@@ -17,7 +15,6 @@ from re import Pattern
1715
import sys
1816
from typing import (
1917
Any,
20-
KeysView,
2118
Literal,
2219
Protocol,
2320
SupportsIndex,
@@ -855,7 +852,7 @@ IndexingInt: TypeAlias = (
855852
)
856853

857854
# AxesData is used for data for Index
858-
AxesData: TypeAlias = Mapping[SeriesDType, Any] | Axes | KeysView
855+
AxesData: TypeAlias = Mapping[S3, Any] | Axes | KeysView
859856

860857
# Any plain Python or numpy function
861858
Function: TypeAlias = np.ufunc | Callable[..., Any]

tests/test_series.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -866,12 +866,11 @@ def test_types_scalar_arithmetic() -> None:
866866
res_pow2: pd.Series = s**0.213
867867
res_pow3: pd.Series = s.pow(0.5)
868868

869-
870869
# GH 103
871870
c = 1 + 1j
872-
s = pd.Series([1.0, 2.0, 3.0])
873-
x = s + c
874-
y = s - c
871+
s_flt = pd.Series([1.0, 2.0, 3.0])
872+
x = s_flt + c
873+
y = s_flt - c
875874

876875

877876
def test_types_groupby() -> None:
@@ -3924,11 +3923,19 @@ def test_series_unstack() -> None:
39243923

39253924

39263925
def test_series_index_type() -> None:
3927-
index = {"a":3, "c": 4}
3926+
index = {"a": 3, "c": 4}
39283927
lst = [1, 2]
39293928

3930-
check(assert_type(pd.Series(lst, index=index), "pd.Series[int]"), pd.Series, np.integer)
3931-
check(assert_type(pd.Series([1, 2], index=index.keys()), "pd.Series[int]"), pd.Series, np.integer)
3929+
check(
3930+
assert_type(pd.Series(lst, index=index), "pd.Series[int]"),
3931+
pd.Series,
3932+
np.integer,
3933+
)
3934+
check(
3935+
assert_type(pd.Series([1, 2], index=index.keys()), "pd.Series[int]"),
3936+
pd.Series,
3937+
np.integer,
3938+
)
39323939

39333940
if TYPE_CHECKING_INVALID_USAGE:
3934-
t = pd.Series([1,2], index="ab") # type: ignore # pyright: ignore[reportCallIssue, reportArgumentType]
3941+
t = pd.Series([1, 2], index="ab") # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType]

0 commit comments

Comments
 (0)