Skip to content

Commit 593113a

Browse files
DOC: add SA01 for pandas.Series.eq (#58759)
* DOC: add SA01 for pandas.Series.eq * DOC: remove SA01 for pandas.Series.eq
1 parent 33682b5 commit 593113a

File tree

2 files changed

+57
-2
lines changed

2 files changed

+57
-2
lines changed

ci/code_checks.sh

-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
164164
-i "pandas.Series.dt.tz_convert PR01,PR02" \
165165
-i "pandas.Series.dt.tz_localize PR01,PR02" \
166166
-i "pandas.Series.dt.unit GL08" \
167-
-i "pandas.Series.eq SA01" \
168167
-i "pandas.Series.ge SA01" \
169168
-i "pandas.Series.gt SA01" \
170169
-i "pandas.Series.list.__getitem__ SA01" \

pandas/core/series.py

+57-1
Original file line numberDiff line numberDiff line change
@@ -5912,14 +5912,70 @@ def _flex_method(self, other, op, *, level=None, fill_value=None, axis: Axis = 0
59125912

59135913
return op(self, other)
59145914

5915-
@Appender(ops.make_flex_doc("eq", "series"))
59165915
def eq(
59175916
self,
59185917
other,
59195918
level: Level | None = None,
59205919
fill_value: float | None = None,
59215920
axis: Axis = 0,
59225921
) -> Series:
5922+
"""
5923+
Return Equal to of series and other, element-wise (binary operator `eq`).
5924+
5925+
Equivalent to ``series == other``, but with support to substitute a fill_value
5926+
for missing data in either one of the inputs.
5927+
5928+
Parameters
5929+
----------
5930+
other : Series or scalar value
5931+
The second operand in this operation.
5932+
level : int or name
5933+
Broadcast across a level, matching Index values on the
5934+
passed MultiIndex level.
5935+
fill_value : None or float value, default None (NaN)
5936+
Fill existing missing (NaN) values, and any new element needed for
5937+
successful Series alignment, with this value before computation.
5938+
If data in both corresponding Series locations is missing
5939+
the result of filling (at that location) will be missing.
5940+
axis : {0 or 'index'}
5941+
Unused. Parameter needed for compatibility with DataFrame.
5942+
5943+
Returns
5944+
-------
5945+
Series
5946+
The result of the operation.
5947+
5948+
See Also
5949+
--------
5950+
Series.ge : Return elementwise Greater than or equal to of series and other.
5951+
Series.le : Return elementwise Less than or equal to of series and other.
5952+
Series.gt : Return elementwise Greater than of series and other.
5953+
Series.lt : Return elementwise Less than of series and other.
5954+
5955+
Examples
5956+
--------
5957+
>>> a = pd.Series([1, 1, 1, np.nan], index=["a", "b", "c", "d"])
5958+
>>> a
5959+
a 1.0
5960+
b 1.0
5961+
c 1.0
5962+
d NaN
5963+
dtype: float64
5964+
>>> b = pd.Series([1, np.nan, 1, np.nan], index=["a", "b", "d", "e"])
5965+
>>> b
5966+
a 1.0
5967+
b NaN
5968+
d 1.0
5969+
e NaN
5970+
dtype: float64
5971+
>>> a.eq(b, fill_value=0)
5972+
a True
5973+
b False
5974+
c False
5975+
d False
5976+
e False
5977+
dtype: bool
5978+
"""
59235979
return self._flex_method(
59245980
other, operator.eq, level=level, fill_value=fill_value, axis=axis
59255981
)

0 commit comments

Comments
 (0)