Skip to content

Commit bd300e4

Browse files
pierre-haessigjorisvandenbossche
authored andcommitted
DOC: minor enhancement of DataFrame.insert docstring (#16341)
1 parent 91e9e52 commit bd300e4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pandas/core/frame.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -2559,15 +2559,17 @@ def insert(self, loc, column, value, allow_duplicates=False):
25592559
"""
25602560
Insert column into DataFrame at specified location.
25612561
2562-
If `allow_duplicates` is False, raises Exception if column
2563-
is already contained in the DataFrame.
2562+
Raises a ValueError if `column` is already contained in the DataFrame,
2563+
unless `allow_duplicates` is set to True.
25642564
25652565
Parameters
25662566
----------
25672567
loc : int
2568-
Must have 0 <= loc <= len(columns)
2569-
column : object
2570-
value : scalar, Series, or array-like
2568+
Insertion index. Must verify 0 <= loc <= len(columns)
2569+
column : string, number, or hashable object
2570+
label of the inserted column
2571+
value : int, Series, or array-like
2572+
allow_duplicates : bool, optional
25712573
"""
25722574
self._ensure_valid_index(value)
25732575
value = self._sanitize_column(column, value, broadcast=False)

0 commit comments

Comments
 (0)