Skip to content

TYP: resolve mypy ignores in core/groupby/ops.py #47064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions pandas/core/groupby/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,16 +416,14 @@ def _reconstruct_ea_result(

if isinstance(values.dtype, StringDtype):
dtype = values.dtype
cls = dtype.construct_array_type()
return cls._from_sequence(res_values, dtype=dtype)
string_array_cls = dtype.construct_array_type()
return string_array_cls._from_sequence(res_values, dtype=dtype)

elif isinstance(values.dtype, BaseMaskedDtype):
new_dtype = self._get_result_dtype(values.dtype.numpy_dtype)
dtype = BaseMaskedDtype.from_numpy_dtype(new_dtype)
# error: Incompatible types in assignment (expression has type
# "Type[BaseMaskedArray]", variable has type "Type[BaseStringArray]")
cls = dtype.construct_array_type() # type: ignore[assignment]
return cls._from_sequence(res_values, dtype=dtype)
masked_array_cls = dtype.construct_array_type()
return masked_array_cls._from_sequence(res_values, dtype=dtype)

elif isinstance(values, (DatetimeArray, TimedeltaArray, PeriodArray)):
# In to_cython_values we took a view as M8[ns]
Expand Down