REF/DEPR: Deprecate AbstractMethodError
State: closed

closes #48909

Probably would need a whatsnew entry, for people inheriting from those now abstract classes. I'll keep this PR as a draft until I replaced all  cases of `AbstractMethodError` (that are actually implemented).

Labels:
name: Refactor
description: Internal refactoring of code
name: Error Reporting
description: Incorrect or improved errors from pandas

Comments:
Just a reminder to please run the ASVs just to ensure there is no perf hit as mentioned in the original issue
I was able to avoid ASV until now :) Can I compare two ASV runs on python 3.10 (that's the only one I have installed):

> $ asv continuous -f 1.1 -E virtualenv upstream/main HEAD
> · No executable found for python 3.8
> · No environments selected
> $ asv continuous -f 1.1 -E existing upstream/main HEAD
> · No range spec may be specified if benchmarking in an existing environment


This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.
Still interested in this @twoertwein? 
> Still interested in this @twoertwein?

Ready for review now :)
I finally setup python 3.8 and ran `asv continuous -f 1.1 -E virtualenv upstream/main abstract`. Stupid question, how do I know whether there were/were no significant changes? It says neither of it at the bottom of the output.

@mroeschke @jbrockmendel 
Happy to rebase occasionally - let me know if there is something else needed for this PR.
Would be great to get this deprecation in for 2.0 @mroeschke
It looks fairly good. Just noting that ideally we want to remove all the old 1.x deprecations before introducing new ones
> It looks fairly good. Just noting that ideally we want to remove all the old 1.x deprecations before introducing new ones

Are now all the 1.x deprecations removed? Rebased it earlier today.
> Would be great to get this deprecation in for 2.0 @mroeschke

now that the rc is cut, aiming for 2.1?
Yeah 2.1 would be good. Sorry @twoertwein for not getting back to this for a bit.
After rebasing mypy reported new errors:

> pandas/core/series.py:1984: error: Cannot instantiate abstract class "SeriesGroupBy" with abstract attribute "_indexed_output_to_ndframe"  [abstract]
> pandas/core/groupby/groupby.py:4240: error: Can only assign concrete classes to a variable of type "Type[GroupBy[Any]]"  [misc]
> pandas/core/groupby/generic.py:1811: error: Cannot instantiate abstract class "SeriesGroupBy" with abstract attribute "_indexed_output_to_ndframe"  [abstract]
> pandas/core/groupby/generic.py:1862: error: Cannot instantiate abstract class "SeriesGroupBy" with abstract attribute "_indexed_output_to_ndframe"  [abstract]

So I remove `@abstractmethod`  from `SeriesGroupBy._indexed_output_to_ndframe` and instead raise inside the method.
_indexed_output_to_ndframe is no longer needed for SGB, can be removed and only exist on DFGB
The ASV Benchmark test seems to have failed - is there a summary of the 11k-line output?
Thinking aloud, it might be best to do this apart of 3.0 as a "breaking change without deprecation
I opened a new pull request #54408 to keep the commit history in this PR intact (rebasing a squashed PR is easier)