Skip to content

Commit 7133447

Browse files
jbrockmendeljreback
authored andcommitted
DOC: fix _validate_names docstring (#29729)
1 parent 1fa7cc2 commit 7133447

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

pandas/io/parsers.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -395,25 +395,22 @@ def _validate_integer(name, val, min_val=0):
395395

396396
def _validate_names(names):
397397
"""
398-
Check if the `names` parameter contains duplicates.
399-
400-
If duplicates are found, we issue a warning before returning.
398+
Raise ValueError if the `names` parameter contains duplicates.
401399
402400
Parameters
403401
----------
404402
names : array-like or None
405403
An array containing a list of the names used for the output DataFrame.
406404
407-
Returns
408-
-------
409-
names : array-like or None
410-
The original `names` parameter.
405+
Raises
406+
------
407+
ValueError
408+
If names are not unique.
411409
"""
412410

413411
if names is not None:
414412
if len(names) != len(set(names)):
415413
raise ValueError("Duplicate names are not allowed.")
416-
return names
417414

418415

419416
def _read(filepath_or_buffer: FilePathOrBuffer, kwds):

0 commit comments

Comments
 (0)