Skip to content

Commit

Permalink
DOC: minor enhancement of DataFrame.insert docstring (#16341)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-haessig authored and jorisvandenbossche committed May 18, 2017
1 parent 91e9e52 commit bd300e4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
@@ -2559,15 +2559,17 @@ def insert(self, loc, column, value, allow_duplicates=False):
"""
Insert column into DataFrame at specified location.
If `allow_duplicates` is False, raises Exception if column
is already contained in the DataFrame.
Raises a ValueError if `column` is already contained in the DataFrame,
unless `allow_duplicates` is set to True.
Parameters
----------
loc : int
Must have 0 <= loc <= len(columns)
column : object
value : scalar, Series, or array-like
Insertion index. Must verify 0 <= loc <= len(columns)
column : string, number, or hashable object
label of the inserted column
value : int, Series, or array-like
allow_duplicates : bool, optional
"""
self._ensure_valid_index(value)
value = self._sanitize_column(column, value, broadcast=False)

0 comments on commit bd300e4

Please sign in to comment.