File tree 14 files changed +164
-171
lines changed
14 files changed +164
-171
lines changed Original file line number Diff line number Diff line change 101
101
]
102
102
Timezone = Union [str , tzinfo ]
103
103
104
- # FrameOrSeries is stricter and ensures that the same subclass of NDFrame always is
105
- # used. E.g. `def func(a: FrameOrSeries ) -> FrameOrSeries : ...` means that if a
104
+ # NDFrameT is stricter and ensures that the same subclass of NDFrame always is
105
+ # used. E.g. `def func(a: NDFrameT ) -> NDFrameT : ...` means that if a
106
106
# Series is passed into a function, a Series is always returned and if a DataFrame is
107
107
# passed in, a DataFrame is always returned.
108
- FrameOrSeries = TypeVar ("FrameOrSeries " , bound = "NDFrame" )
108
+ NDFrameT = TypeVar ("NDFrameT " , bound = "NDFrame" )
109
109
110
110
Axis = Union [str , int ]
111
111
IndexLabel = Union [Hashable , Sequence [Hashable ]]
Original file line number Diff line number Diff line change 30
30
AggFuncTypeDict ,
31
31
AggObjType ,
32
32
Axis ,
33
- FrameOrSeries ,
33
+ NDFrameT ,
34
34
)
35
35
from pandas .util ._decorators import cache_readonly
36
36
from pandas .util ._exceptions import find_stack_level
@@ -1120,7 +1120,7 @@ def apply_standard(self) -> DataFrame | Series:
1120
1120
class GroupByApply (Apply ):
1121
1121
def __init__ (
1122
1122
self ,
1123
- obj : GroupBy [FrameOrSeries ],
1123
+ obj : GroupBy [NDFrameT ],
1124
1124
func : AggFuncType ,
1125
1125
args ,
1126
1126
kwargs ,
Original file line number Diff line number Diff line change 22
22
from pandas ._typing import (
23
23
ArrayLike ,
24
24
DtypeObj ,
25
- FrameOrSeries ,
26
25
IndexLabel ,
26
+ NDFrameT ,
27
27
Shape ,
28
28
npt ,
29
29
)
@@ -181,13 +181,13 @@ class SpecificationError(Exception):
181
181
pass
182
182
183
183
184
- class SelectionMixin (Generic [FrameOrSeries ]):
184
+ class SelectionMixin (Generic [NDFrameT ]):
185
185
"""
186
186
mixin implementing the selection & aggregation interface on a group-like
187
187
object sub-classes need to define: obj, exclusions
188
188
"""
189
189
190
- obj : FrameOrSeries
190
+ obj : NDFrameT
191
191
_selection : IndexLabel | None = None
192
192
exclusions : frozenset [Hashable ]
193
193
_internal_names = ["_cache" , "__setstate__" ]
Original file line number Diff line number Diff line change 15
15
16
16
import numpy as np
17
17
18
- from pandas ._typing import FrameOrSeries
19
18
from pandas .errors import PerformanceWarning
20
19
21
20
from pandas .core .dtypes .generic import (
28
27
from pandas .core .computation .common import result_type_many
29
28
30
29
if TYPE_CHECKING :
30
+ from pandas .core .generic import NDFrame
31
31
from pandas .core .indexes .api import Index
32
32
33
33
34
34
def _align_core_single_unary_op (
35
35
term ,
36
- ) -> tuple [partial | type [FrameOrSeries ], dict [str , Index ] | None ]:
36
+ ) -> tuple [partial | type [NDFrame ], dict [str , Index ] | None ]:
37
37
38
- typ : partial | type [FrameOrSeries ]
38
+ typ : partial | type [NDFrame ]
39
39
axes : dict [str , Index ] | None = None
40
40
41
41
if isinstance (term .value , np .ndarray ):
@@ -49,7 +49,7 @@ def _align_core_single_unary_op(
49
49
50
50
51
51
def _zip_axes_from_type (
52
- typ : type [FrameOrSeries ], new_axes : Sequence [Index ]
52
+ typ : type [NDFrame ], new_axes : Sequence [Index ]
53
53
) -> dict [str , Index ]:
54
54
return {name : new_axes [i ] for i , name in enumerate (typ ._AXIS_ORDERS )}
55
55
Original file line number Diff line number Diff line change 22
22
import numpy as np
23
23
24
24
from pandas ._libs .tslibs import Timestamp
25
- from pandas ._typing import FrameOrSeries
25
+ from pandas ._typing import NDFrameT
26
26
from pandas .util ._validators import validate_percentile
27
27
28
28
from pandas .core .dtypes .common import (
45
45
46
46
def describe_ndframe (
47
47
* ,
48
- obj : FrameOrSeries ,
48
+ obj : NDFrameT ,
49
49
include : str | Sequence [str ] | None ,
50
50
exclude : str | Sequence [str ] | None ,
51
51
datetime_is_numeric : bool ,
52
52
percentiles : Sequence [float ] | np .ndarray | None ,
53
- ) -> FrameOrSeries :
53
+ ) -> NDFrameT :
54
54
"""Describe series or dataframe.
55
55
56
56
Called from pandas.core.generic.NDFrame.describe()
@@ -91,7 +91,7 @@ def describe_ndframe(
91
91
)
92
92
93
93
result = describer .describe (percentiles = percentiles )
94
- return cast (FrameOrSeries , result )
94
+ return cast (NDFrameT , result )
95
95
96
96
97
97
class NDFrameDescriberAbstract (ABC ):
You can’t perform that action at this time.
0 commit comments