DEPR: support axis=None in DataFrame reductions
State: closed

- [x] closes #21597 (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Haven't yet added tests or docs, want to see if anyone cares about the warnings we get in the groupby tests when we do e.g. `gb.apply(np.sum)`

Labels:
name: Deprecate
description: Functionality to remove in pandas
name: Reduction Operations
description: sum, mean, min, max, etc.

Comments:
Will users also see this message when doing `np.sum(df)`? Might make sense say `DataFrame.sum or numpy.sum`. Then the error message would also make sense in the groupby apply case.
Looks like this does produce the warning for `np.sum(df)`, will update
Hmm looks like the warning also shows up for the built-in `sum`, but not `min` (while applying np.min already operates over axis=None)
```

pandas/core/series.py:6050: error: Argument 1 of "prod" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/series.py:6050: note: This violates the Liskov substitution principle
pandas/core/series.py:6050: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/series.py:6081: error: Argument 1 of "sem" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/series.py:6081: note: This violates the Liskov substitution principle
pandas/core/series.py:6081: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/series.py:6092: error: Argument 1 of "var" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/series.py:6092: note: This violates the Liskov substitution principle
pandas/core/series.py:6092: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/series.py:6103: error: Argument 1 of "std" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/series.py:6103: note: This violates the Liskov substitution principle
pandas/core/series.py:6103: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/frame.py:11001: error: Argument 1 of "sum" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/frame.py:11001: note: This violates the Liskov substitution principle
pandas/core/frame.py:11001: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/frame.py:11013: error: Argument 1 of "prod" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/frame.py:11013: note: This violates the Liskov substitution principle
pandas/core/frame.py:11013: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/frame.py:11044: error: Argument 1 of "sem" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/frame.py:11044: note: This violates the Liskov substitution principle
pandas/core/frame.py:11044: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/frame.py:11055: error: Argument 1 of "var" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/frame.py:11055: note: This violates the Liskov substitution principle
pandas/core/frame.py:11055: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/frame.py:11066: error: Argument 1 of "std" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/frame.py:11066: note: This violates the Liskov substitution principle
pandas/core/frame.py:11066: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/frame.py:11096: error: Incompatible types in assignment (expression has type "Callable[[Optional[Union[int, Literal['index', 'columns', 'rows']]], bool, bool, int, KwArg(Any)], Any]", base class "NDFrame" defined the type as "Callable[[Union[int, None, Literal['index', 'columns', 'rows', _NoDefault.no_default]], bool, bool, int, KwArg(Any)], Any]")  [assignment]
Found 11 errors in 2 files (checked 1418 source files)

mypy (stubtest)............................................................Failed
- hook id: stubtest
- duration: 117.05s
- exit code: 1

error: not checking stubs due to mypy build errors:
pandas/core/series.py:6039: error: Argument 1 of "sum" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/series.py:6039: note: This violates the Liskov substitution principle
pandas/core/series.py:6039: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/series.py:6050: error: Argument 1 of "prod" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/series.py:6050: note: This violates the Liskov substitution principle
pandas/core/series.py:6050: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/series.py:6081: error: Argument 1 of "sem" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/series.py:6081: note: This violates the Liskov substitution principle
pandas/core/series.py:6081: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/series.py:6092: error: Argument 1 of "var" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/series.py:6092: note: This violates the Liskov substitution principle
pandas/core/series.py:6092: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/series.py:6103: error: Argument 1 of "std" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/series.py:6103: note: This violates the Liskov substitution principle
pandas/core/series.py:6103: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/frame.py:11001: error: Argument 1 of "sum" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/frame.py:11001: note: This violates the Liskov substitution principle
pandas/core/frame.py:11001: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/frame.py:11013: error: Argument 1 of "prod" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/frame.py:11013: note: This violates the Liskov substitution principle
pandas/core/frame.py:11013: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/frame.py:11044: error: Argument 1 of "sem" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/frame.py:11044: note: This violates the Liskov substitution principle
pandas/core/frame.py:11044: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/frame.py:11055: error: Argument 1 of "var" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/frame.py:11055: note: This violates the Liskov substitution principle
pandas/core/frame.py:11055: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/frame.py:11066: error: Argument 1 of "std" is incompatible with supertype "NDFrame"; supertype defines the argument type as "Union[Union[int, Literal['index', 'columns', 'rows']], None, Literal[_NoDefault.no_default]]"  [override]
pandas/core/frame.py:11066: note: This violates the Liskov substitution principle
pandas/core/frame.py:11066: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
pandas/core/frame.py:11096: error: Incompatible types in assignment (expression has type "Callable[[Optional[Union[int, Literal['index', 'columns', 'rows']]], bool, bool, int, KwArg(Any)], Any]", base class "NDFrame" defined the type as "Callable[[Union[int, None, Literal['index', 'columns', 'rows', _NoDefault.no_default]], bool, bool, int, KwArg(Any)], Any]")  [assignment]
```
updated+green
Thanks @jbrockmendel