Skip to content

Commit 1793f88

Browse files
GH1180 Clean up all/any methods for Series and DataFrame (#1188)
* GH1180 Clean up all/any methods for Series and DataFrame * GH1180 Revert change in _typing.pyi * GH1180 PR Feedback
1 parent 8434bde commit 1793f88

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Diff for: pandas-stubs/core/frame.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -1660,7 +1660,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
16601660
bool_only: _bool | None = ...,
16611661
skipna: _bool = ...,
16621662
**kwargs: Any,
1663-
) -> _bool: ...
1663+
) -> np.bool: ...
16641664
@overload
16651665
def all(
16661666
self,
@@ -1677,7 +1677,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
16771677
bool_only: _bool | None = ...,
16781678
skipna: _bool = ...,
16791679
**kwargs: Any,
1680-
) -> _bool: ...
1680+
) -> np.bool: ...
16811681
@overload
16821682
def any(
16831683
self,

Diff for: pandas-stubs/core/series.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -1744,15 +1744,15 @@ class Series(IndexOpsMixin[S1], NDFrame):
17441744
bool_only: _bool | None = ...,
17451745
skipna: _bool = ...,
17461746
**kwargs: Any,
1747-
) -> _bool: ...
1747+
) -> np.bool: ...
17481748
def any(
17491749
self,
17501750
*,
17511751
axis: AxisIndex = ...,
17521752
bool_only: _bool | None = ...,
17531753
skipna: _bool = ...,
17541754
**kwargs: Any,
1755-
) -> _bool: ...
1755+
) -> np.bool: ...
17561756
def cummax(
17571757
self,
17581758
axis: AxisIndex | None = ...,

Diff for: tests/test_frame.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ def test_types_init() -> None:
120120
def test_types_all() -> None:
121121
df = pd.DataFrame([[False, True], [False, False]], columns=["col1", "col2"])
122122
check(assert_type(df.all(), "pd.Series[bool]"), pd.Series, np.bool_)
123-
check(assert_type(df.all(axis=None), bool), np.bool_)
123+
check(assert_type(df.all(axis=None), np.bool_), np.bool_)
124124

125125

126126
def test_types_any() -> None:
127127
df = pd.DataFrame([[False, True], [False, False]], columns=["col1", "col2"])
128128
check(assert_type(df.any(), "pd.Series[bool]"), pd.Series, np.bool_)
129-
check(assert_type(df.any(axis=None), bool), np.bool_)
129+
check(assert_type(df.any(axis=None), np.bool_), np.bool_)
130130

131131

132132
def test_types_append() -> None:

Diff for: tests/test_series.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,15 @@ def test_types_init() -> None:
134134

135135

136136
def test_types_any() -> None:
137-
check(assert_type(pd.Series([False, False]).any(), bool), np.bool_)
138-
check(assert_type(pd.Series([False, False]).any(bool_only=False), bool), np.bool_)
139-
check(assert_type(pd.Series([np.nan]).any(skipna=False), bool), np.bool_)
137+
check(assert_type(pd.Series([False, False]).any(), np.bool), np.bool)
138+
check(assert_type(pd.Series([False, False]).any(bool_only=False), np.bool), np.bool)
139+
check(assert_type(pd.Series([np.nan]).any(skipna=False), np.bool), np.bool)
140140

141141

142142
def test_types_all() -> None:
143-
check(assert_type(pd.Series([False, False]).all(), bool), np.bool_)
144-
check(assert_type(pd.Series([False, False]).all(bool_only=False), bool), np.bool_)
145-
check(assert_type(pd.Series([np.nan]).all(skipna=False), bool), np.bool_)
143+
check(assert_type(pd.Series([False, False]).all(), np.bool), np.bool)
144+
check(assert_type(pd.Series([False, False]).all(bool_only=False), np.bool), np.bool)
145+
check(assert_type(pd.Series([np.nan]).all(skipna=False), np.bool), np.bool)
146146

147147

148148
def test_types_csv() -> None:

0 commit comments

Comments
 (0)