6
6
from collections import defaultdict
7
7
from functools import partial
8
8
from typing import (
9
+ TYPE_CHECKING ,
9
10
Any ,
10
11
Callable ,
11
12
DefaultDict ,
26
27
from pandas .core .base import SpecificationError
27
28
import pandas .core .common as com
28
29
from pandas .core .indexes .api import Index
29
- from pandas .core .series import Series
30
+
31
+ if TYPE_CHECKING :
32
+ from pandas .core .series import Series
30
33
31
34
32
35
def reconstruct_func (
@@ -281,7 +284,7 @@ def relabel_result(
281
284
func : Dict [str , List [Union [Callable , str ]]],
282
285
columns : Iterable [Label ],
283
286
order : Iterable [int ],
284
- ) -> Dict [Label , Series ]:
287
+ ) -> Dict [Label , " Series" ]:
285
288
"""
286
289
Internal function to reorder result if relabelling is True for
287
290
dataframe.agg, and return the reordered result in dict.
@@ -308,10 +311,10 @@ def relabel_result(
308
311
reordered_indexes = [
309
312
pair [0 ] for pair in sorted (zip (columns , order ), key = lambda t : t [1 ])
310
313
]
311
- reordered_result_in_dict : Dict [Label , Series ] = {}
314
+ reordered_result_in_dict : Dict [Label , " Series" ] = {}
312
315
idx = 0
313
316
314
- reorder_mask = not isinstance (result , Series ) and len (result .columns ) > 1
317
+ reorder_mask = not isinstance (result , ABCSeries ) and len (result .columns ) > 1
315
318
for col , fun in func .items ():
316
319
s = result [col ].dropna ()
317
320
0 commit comments