Skip to content

DataFrame.max needs the same overloads as DataFrame.any has #1488

@MarcoGorelli

Description

@MarcoGorelli

Describe the bug
max and other aggregations are missing some overloads, like any has

@overload
def any(
self,
*,
axis: None,
bool_only: _bool | None = ...,
skipna: _bool = ...,
**kwargs: Any,
) -> np.bool: ...
@overload
def any(
self,
*,
axis: Axis = ...,
bool_only: _bool | None = ...,
skipna: _bool = ...,
**kwargs: Any,
) -> Series[_bool]: ...

def max(
self,
axis: Axis | None = ...,
skipna: _bool | None = True,
numeric_only: _bool = False,
**kwargs: Any,
) -> Series: ...

To Reproduce

df = pd.DataFrame({'a': [1,2,3], 'b': [4,5,6]})
print(df.max(axis=None))

The stubs say this always returns Series, but actually, for axis=None, it returns a scalar

Please complete the following information:

  • OS: [e.g. Windows, Linux, MacOS]
  • OS Version [e.g. 22]
  • python version
  • version of type checker
  • version of installed pandas-stubs

Additional context
Add any other context about the problem here.

Metadata

Metadata

Labels

DataFrameDataFrame data structure

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions