Skip to content

Commit 10228cb

Browse files
authored
DOC: Improve docstring of Index.delete (#32015)
1 parent 2e8274b commit 10228cb

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

pandas/core/indexes/base.py

+22-1
Original file line numberDiff line numberDiff line change
@@ -5135,9 +5135,30 @@ def delete(self, loc):
51355135
"""
51365136
Make new Index with passed location(-s) deleted.
51375137
5138+
Parameters
5139+
----------
5140+
loc : int or list of int
5141+
Location of item(-s) which will be deleted.
5142+
Use a list of locations to delete more than one value at the same time.
5143+
51385144
Returns
51395145
-------
5140-
new_index : Index
5146+
Index
5147+
New Index with passed location(-s) deleted.
5148+
5149+
See Also
5150+
--------
5151+
numpy.delete : Delete any rows and column from NumPy array (ndarray).
5152+
5153+
Examples
5154+
--------
5155+
>>> idx = pd.Index(['a', 'b', 'c'])
5156+
>>> idx.delete(1)
5157+
Index(['a', 'c'], dtype='object')
5158+
5159+
>>> idx = pd.Index(['a', 'b', 'c'])
5160+
>>> idx.delete([0, 2])
5161+
Index(['b'], dtype='object')
51415162
"""
51425163
return self._shallow_copy(np.delete(self._data, loc))
51435164

0 commit comments

Comments
 (0)