Skip to content

Commit 7ac5836

Browse files
GH1488 Add overload for DataFrame.max when axis is None
1 parent 2fdf7ed commit 7ac5836

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pandas-stubs/core/frame.pyi

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2344,9 +2344,18 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
23442344
axis: Axis | None = ...,
23452345
level: Level | None = None,
23462346
) -> Self: ...
2347+
@overload
23472348
def max(
23482349
self,
2349-
axis: Axis | None = 0,
2350+
axis: None,
2351+
skipna: _bool | None = True,
2352+
numeric_only: _bool = False,
2353+
**kwargs: Any,
2354+
) -> Scalar: ...
2355+
@overload
2356+
def max(
2357+
self,
2358+
axis: Axis = 0,
23502359
skipna: _bool | None = True,
23512360
numeric_only: _bool = False,
23522361
**kwargs: Any,

tests/test_frame.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,7 @@ def test_types_max() -> None:
826826
df = pd.DataFrame(data={"col1": [2, 1], "col2": [3, 4]})
827827
check(assert_type(df.max(), pd.Series), pd.Series)
828828
check(assert_type(df.max(axis=0), pd.Series), pd.Series)
829+
check(assert_type(df.max(axis=None), Scalar), np.int64)
829830

830831

831832
def test_types_quantile() -> None:

0 commit comments

Comments
 (0)