Skip to content

Commit 2753b17

Browse files
DOC: Add SA01 for pandas.Series.le (#58755)
* DOC: add SA01 for pandas.Series.le * DOC: remove SA01 for pandas.Series.le
1 parent 62e95db commit 2753b17

File tree

2 files changed

+61
-2
lines changed

2 files changed

+61
-2
lines changed

ci/code_checks.sh

-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
169169
-i "pandas.Series.gt SA01" \
170170
-i "pandas.Series.kurt RT03,SA01" \
171171
-i "pandas.Series.kurtosis RT03,SA01" \
172-
-i "pandas.Series.le SA01" \
173172
-i "pandas.Series.list.__getitem__ SA01" \
174173
-i "pandas.Series.list.flatten SA01" \
175174
-i "pandas.Series.list.len SA01" \

pandas/core/series.py

+61-1
Original file line numberDiff line numberDiff line change
@@ -5930,8 +5930,68 @@ def ne(self, other, level=None, fill_value=None, axis: Axis = 0) -> Series:
59305930
other, operator.ne, level=level, fill_value=fill_value, axis=axis
59315931
)
59325932

5933-
@Appender(ops.make_flex_doc("le", "series"))
59345933
def le(self, other, level=None, fill_value=None, axis: Axis = 0) -> Series:
5934+
"""
5935+
Return Less than or equal to of series and other, \
5936+
element-wise (binary operator `le`).
5937+
5938+
Equivalent to ``series <= other``, but with support to substitute a
5939+
fill_value for missing data in either one of the inputs.
5940+
5941+
Parameters
5942+
----------
5943+
other : Series or scalar value
5944+
The second operand in this operation.
5945+
level : int or name
5946+
Broadcast across a level, matching Index values on the
5947+
passed MultiIndex level.
5948+
fill_value : None or float value, default None (NaN)
5949+
Fill existing missing (NaN) values, and any new element needed for
5950+
successful Series alignment, with this value before computation.
5951+
If data in both corresponding Series locations is missing
5952+
the result of filling (at that location) will be missing.
5953+
axis : {0 or 'index'}
5954+
Unused. Parameter needed for compatibility with DataFrame.
5955+
5956+
Returns
5957+
-------
5958+
Series
5959+
The result of the operation.
5960+
5961+
See Also
5962+
--------
5963+
Series.ge : Return elementwise Greater than or equal to of series and other.
5964+
Series.lt : Return elementwise Less than of series and other.
5965+
Series.gt : Return elementwise Greater than of series and other.
5966+
Series.eq : Return elementwise equal to of series and other.
5967+
5968+
Examples
5969+
--------
5970+
>>> a = pd.Series([1, 1, 1, np.nan, 1], index=['a', 'b', 'c', 'd', 'e'])
5971+
>>> a
5972+
a 1.0
5973+
b 1.0
5974+
c 1.0
5975+
d NaN
5976+
e 1.0
5977+
dtype: float64
5978+
>>> b = pd.Series([0, 1, 2, np.nan, 1], index=['a', 'b', 'c', 'd', 'f'])
5979+
>>> b
5980+
a 0.0
5981+
b 1.0
5982+
c 2.0
5983+
d NaN
5984+
f 1.0
5985+
dtype: float64
5986+
>>> a.le(b, fill_value=0)
5987+
a False
5988+
b True
5989+
c True
5990+
d False
5991+
e False
5992+
f True
5993+
dtype: bool
5994+
"""
59355995
return self._flex_method(
59365996
other, operator.le, level=level, fill_value=fill_value, axis=axis
59375997
)

0 commit comments

Comments
 (0)