From b4c4e4c80e63fc184879063d99773376c2abd231 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Tue, 19 Nov 2019 18:09:59 -0800 Subject: [PATCH 1/2] fix _validate_names docstring --- pandas/io/parsers.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index 2cb4a5c8bb2f6..a9193bc3a5851 100755 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -395,25 +395,17 @@ def _validate_integer(name, val, min_val=0): def _validate_names(names): """ - Check if the `names` parameter contains duplicates. - - If duplicates are found, we issue a warning before returning. + Raise ValueError if the `names` parameter contains duplicates. Parameters ---------- names : array-like or None An array containing a list of the names used for the output DataFrame. - - Returns - ------- - names : array-like or None - The original `names` parameter. """ if names is not None: if len(names) != len(set(names)): raise ValueError("Duplicate names are not allowed.") - return names def _read(filepath_or_buffer: FilePathOrBuffer, kwds): From 44443e84d0cd6bbf928f4681bce9a2fd24ebf1e0 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Wed, 20 Nov 2019 07:05:57 -0800 Subject: [PATCH 2/2] raises section in docstring --- pandas/io/parsers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index a9193bc3a5851..ff3583b79d79c 100755 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -401,6 +401,11 @@ def _validate_names(names): ---------- names : array-like or None An array containing a list of the names used for the output DataFrame. + + Raises + ------ + ValueError + If names are not unique. """ if names is not None: