|
1 | 1 | import abc
|
2 | 2 | import inspect
|
3 |
| -from typing import TYPE_CHECKING, Any, Dict, Iterator, Optional, Tuple, Type, Union |
| 3 | +from typing import TYPE_CHECKING, Any, Dict, Iterator, Optional, Tuple, Type |
4 | 4 |
|
5 | 5 | import numpy as np
|
6 | 6 |
|
7 | 7 | from pandas._config import option_context
|
8 | 8 |
|
9 |
| -from pandas._typing import Axis |
| 9 | +from pandas._typing import Axis, FrameOrSeriesUnion |
10 | 10 | from pandas.util._decorators import cache_readonly
|
11 | 11 |
|
12 | 12 | from pandas.core.dtypes.common import is_dict_like, is_list_like, is_sequence
|
@@ -73,7 +73,7 @@ def series_generator(self) -> Iterator["Series"]:
|
73 | 73 | @abc.abstractmethod
|
74 | 74 | def wrap_results_for_axis(
|
75 | 75 | self, results: ResType, res_index: "Index"
|
76 |
| - ) -> Union["Series", "DataFrame"]: |
| 76 | + ) -> FrameOrSeriesUnion: |
77 | 77 | pass
|
78 | 78 |
|
79 | 79 | # ---------------------------------------------------------------
|
@@ -289,9 +289,7 @@ def apply_series_generator(self) -> Tuple[ResType, "Index"]:
|
289 | 289 |
|
290 | 290 | return results, res_index
|
291 | 291 |
|
292 |
| - def wrap_results( |
293 |
| - self, results: ResType, res_index: "Index" |
294 |
| - ) -> Union["Series", "DataFrame"]: |
| 292 | + def wrap_results(self, results: ResType, res_index: "Index") -> FrameOrSeriesUnion: |
295 | 293 | from pandas import Series
|
296 | 294 |
|
297 | 295 | # see if we can infer the results
|
@@ -335,7 +333,7 @@ def result_columns(self) -> "Index":
|
335 | 333 |
|
336 | 334 | def wrap_results_for_axis(
|
337 | 335 | self, results: ResType, res_index: "Index"
|
338 |
| - ) -> Union["Series", "DataFrame"]: |
| 336 | + ) -> FrameOrSeriesUnion: |
339 | 337 | """ return the results for the rows """
|
340 | 338 |
|
341 | 339 | if self.result_type == "reduce":
|
@@ -408,9 +406,9 @@ def result_columns(self) -> "Index":
|
408 | 406 |
|
409 | 407 | def wrap_results_for_axis(
|
410 | 408 | self, results: ResType, res_index: "Index"
|
411 |
| - ) -> Union["Series", "DataFrame"]: |
| 409 | + ) -> FrameOrSeriesUnion: |
412 | 410 | """ return the results for the columns """
|
413 |
| - result: Union["Series", "DataFrame"] |
| 411 | + result: FrameOrSeriesUnion |
414 | 412 |
|
415 | 413 | # we have requested to expand
|
416 | 414 | if self.result_type == "expand":
|
|
0 commit comments