Skip to content

Commit c9fb49b

Browse files
authored
DOC: add Series.__invert__ docstring template
1 parent 2428f9d commit c9fb49b

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

pandas/core/ops/docstrings.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,3 +781,41 @@ def make_flex_doc(op_name: str, typ: str) -> str:
781781
B True False
782782
C True False
783783
"""
784+
785+
# --- add at bottom of pandas/core/ops/docstrings.py ---
786+
787+
_doc_series_invert = """
788+
Bitwise NOT (``~``).
789+
790+
For boolean dtype, behaves as logical NOT. Missing values (``NA``) propagate.
791+
For integer dtypes, performs bitwise inversion (two's complement) elementwise.
792+
793+
Returns
794+
-------
795+
Series
796+
Elementwise result with the same index and name.
797+
798+
Notes
799+
-----
800+
On ``boolean[pyarrow]`` dtype, ``NA`` values also propagate under ``~``.
801+
802+
See Also
803+
--------
804+
Series.__and__, Series.__or__, Series.__xor__
805+
806+
Examples
807+
--------
808+
>>> s = pd.Series([True, False, pd.NA], dtype="boolean")
809+
>>> ~s
810+
0 False
811+
1 True
812+
2 <NA>
813+
dtype: boolean
814+
815+
>>> s = pd.Series([1, 2, -3], dtype="Int32")
816+
>>> ~s
817+
0 -2
818+
1 -3
819+
2 2
820+
dtype: Int32
821+
"""

0 commit comments

Comments
 (0)