File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -1724,11 +1724,12 @@ def _agg_py_fallback(
1724
1724
# preserve the kind of exception that raised
1725
1725
raise type (err )(msg ) from err
1726
1726
1727
- if ser .dtype == object :
1727
+ dtype = ser .dtype
1728
+ if dtype == object :
1728
1729
res_values = res_values .astype (object , copy = False )
1729
- elif is_string_dtype (ser . dtype ) and how in ["min" , "max" ]:
1730
- dtype = ser . dtype
1731
- string_array_cls = dtype .construct_array_type ()
1730
+ elif is_string_dtype (dtype ) and how in ["min" , "max" ]:
1731
+ # mypy doesn't infer dtype is an ExtensionDtype
1732
+ string_array_cls = dtype .construct_array_type () # type: ignore[union-attr]
1732
1733
res_values = string_array_cls ._from_sequence (res_values , dtype = dtype )
1733
1734
1734
1735
# If we are DataFrameGroupBy and went through a SeriesGroupByPath
You can’t perform that action at this time.
0 commit comments