File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -127,9 +127,9 @@ F = TypeVar("F", bound=FuncType)
127
127
HashableT = TypeVar ("HashableT" , bound = Hashable )
128
128
129
129
AggFuncTypeBase : TypeAlias = Union [Callable , str , np .ufunc ]
130
- AggFuncTypeDictSeries : TypeAlias = Mapping [Hashable , AggFuncTypeBase ]
130
+ AggFuncTypeDictSeries : TypeAlias = Mapping [HashableT , AggFuncTypeBase ]
131
131
AggFuncTypeDictFrame : TypeAlias = Mapping [
132
- Hashable , Union [AggFuncTypeBase , list [AggFuncTypeBase ]]
132
+ HashableT , Union [AggFuncTypeBase , list [AggFuncTypeBase ]]
133
133
]
134
134
AggFuncTypeSeriesToFrame : TypeAlias = Union [
135
135
list [AggFuncTypeBase ],
Original file line number Diff line number Diff line change @@ -670,6 +670,10 @@ def test_types_groupby_agg() -> None:
670
670
0 : lambda x : x .min (),
671
671
}
672
672
check (assert_type (df .groupby ("col1" ).agg (agg_dict3 ), pd .DataFrame ), pd .DataFrame )
673
+ agg_dict4 = {"col2" : "sum" }
674
+ check (assert_type (df .groupby ("col1" ).agg (agg_dict4 ), pd .DataFrame ), pd .DataFrame )
675
+ agg_dict5 = {0 : "sum" }
676
+ check (assert_type (df .groupby ("col1" ).agg (agg_dict5 ), pd .DataFrame ), pd .DataFrame )
673
677
named_agg = pd .NamedAgg (column = "col2" , aggfunc = "max" )
674
678
check (
675
679
assert_type (df .groupby ("col1" ).agg (new_col = named_agg ), pd .DataFrame ),
You can’t perform that action at this time.
0 commit comments