Skip to content

Commit 5bf89a8

Browse files
Better documentation as per @gfyoung
1 parent dced1b7 commit 5bf89a8

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

pandas/io/parsers.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,8 +1068,24 @@ def _evaluate_usecols(usecols, names):
10681068
def _validate_usecols(usecols, names):
10691069
"""
10701070
Validates that all usecols are present in a given
1071-
list of names, if not, raise a ValueError that
1071+
list of names. If not, raise a ValueError that
10721072
shows what usecols are missing.
1073+
1074+
Parameters
1075+
----------
1076+
usecols : iterable of usecols
1077+
The columns to validate are present in names.
1078+
names : iterable of names
1079+
The column names to check against.
1080+
1081+
Returns
1082+
-------
1083+
usecols : iterable of usecols
1084+
The `usecols` parameter if the validation succeeds.
1085+
1086+
Raises
1087+
------
1088+
ValueError : Detailing which usecols are missing, if any.
10731089
"""
10741090
missing = [c for c in usecols if c not in names]
10751091
if len(missing) > 0:
@@ -1078,6 +1094,8 @@ def _validate_usecols(usecols, names):
10781094
"columns expected but not found: {missing}".format(missing=missing)
10791095
)
10801096

1097+
return usecols
1098+
10811099

10821100
def _validate_skipfooter_arg(skipfooter):
10831101
"""

0 commit comments

Comments
 (0)