@@ -322,19 +322,19 @@ def transform(self) -> DataFrame | Series:
322322 return obj .T .transform (func , 0 , * args , ** kwargs ).T
323323
324324 if is_list_like (func ) and not is_dict_like (func ):
325- func = cast (list [AggFuncTypeBase ], func )
325+ func = cast (" list[AggFuncTypeBase]" , func )
326326 # Convert func equivalent dict
327327 if is_series :
328328 func = {com .get_callable_name (v ) or v : v for v in func }
329329 else :
330- func = { col : func for col in obj }
330+ func = dict . fromkeys ( obj , func )
331331
332332 if is_dict_like (func ):
333- func = cast (AggFuncTypeDict , func )
333+ func = cast (" AggFuncTypeDict" , func )
334334 return self .transform_dict_like (func )
335335
336336 # func is either str or callable
337- func = cast (AggFuncTypeBase , func )
337+ func = cast (" AggFuncTypeBase" , func )
338338 try :
339339 result = self .transform_str_or_callable (func )
340340 except TypeError :
@@ -434,7 +434,7 @@ def compute_list_like(
434434 Data for result. When aggregating with a Series, this can contain any
435435 Python objects.
436436 """
437- func = cast (list [AggFuncTypeBase ], self .func )
437+ func = cast (" list[AggFuncTypeBase]" , self .func )
438438 obj = self .obj
439439
440440 results = []
@@ -541,7 +541,7 @@ def compute_dict_like(
541541
542542 obj = self .obj
543543 is_groupby = isinstance (obj , (DataFrameGroupBy , SeriesGroupBy ))
544- func = cast (AggFuncTypeDict , self .func )
544+ func = cast (" AggFuncTypeDict" , self .func )
545545 func = self .normalize_dictlike_arg (op_name , selected_obj , func )
546546
547547 is_non_unique_col = (
@@ -666,7 +666,7 @@ def apply_str(self) -> DataFrame | Series:
666666 result: Series or DataFrame
667667 """
668668 # Caller is responsible for checking isinstance(self.f, str)
669- func = cast (str , self .func )
669+ func = cast (" str" , self .func )
670670
671671 obj = self .obj
672672
@@ -1262,7 +1262,7 @@ def numba_func(values, col_names, df_index, *args):
12621262 return numba_func
12631263
12641264 def apply_with_numba (self ) -> dict [int , Any ]:
1265- func = cast (Callable , self .func )
1265+ func = cast (" Callable" , self .func )
12661266 args , kwargs = prepare_function_arguments (
12671267 func , self .args , self .kwargs , num_required_args = 1
12681268 )
@@ -1404,7 +1404,7 @@ def numba_func(values, col_names_index, index, *args):
14041404 return numba_func
14051405
14061406 def apply_with_numba (self ) -> dict [int , Any ]:
1407- func = cast (Callable , self .func )
1407+ func = cast (" Callable" , self .func )
14081408 args , kwargs = prepare_function_arguments (
14091409 func , self .args , self .kwargs , num_required_args = 1
14101410 )
@@ -1551,7 +1551,7 @@ def apply_compat(self):
15511551
15521552 def apply_standard (self ) -> DataFrame | Series :
15531553 # caller is responsible for ensuring that f is Callable
1554- func = cast (Callable , self .func )
1554+ func = cast (" Callable" , self .func )
15551555 obj = self .obj
15561556
15571557 if isinstance (func , np .ufunc ):
0 commit comments