Skip to content

Commit 8075978

Browse files
further enhancement of DataFrame.insert docstring
1 parent e9a3b44 commit 8075978

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pandas/core/frame.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,16 +1844,18 @@ def _set_item(self, key, value):
18441844
def insert(self, loc, column, value, allow_duplicates=False):
18451845
"""
18461846
Insert column into DataFrame at specified location.
1847-
if allow_duplicates is False, Raises Exception if column is already contained in the DataFrame
1847+
1848+
Raises a ValueError if `column` is already contained in the DataFrame,
1849+
unless `allow_duplicates` is set to True.
18481850
18491851
Parameters
18501852
----------
18511853
loc : int
18521854
Insertion index. Must verify 0 <= loc <= len(columns)
18531855
column : string, number, or hashable object
1854-
label of the column
1856+
label of the inserted column
18551857
value : int, Series, or array-like
1856-
allow_duplicates : bool
1858+
allow_duplicates : bool, optional
18571859
"""
18581860
value = self._sanitize_column(column, value)
18591861
self._data.insert(

0 commit comments

Comments
 (0)