Skip to content

Commit cc7a10c

Browse files
ignamvjreback
authored andcommitted
DOC: read_csv usecols element order is ignored (#18729)
1 parent 4a2d55b commit cc7a10c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

doc/source/io.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ usecols : array-like or callable, default ``None``
131131
be positional (i.e. integer indices into the document columns) or strings
132132
that correspond to column names provided either by the user in `names` or
133133
inferred from the document header row(s). For example, a valid array-like
134-
`usecols` parameter would be [0, 1, 2] or ['foo', 'bar', 'baz'].
134+
`usecols` parameter would be [0, 1, 2] or ['foo', 'bar', 'baz']. Element
135+
order is ignored, so usecols=[0,1] is the same as [1, 0].
135136

136137
If callable, the callable function will be evaluated against the column names,
137138
returning names where the callable function evaluates to True:
@@ -2789,11 +2790,11 @@ to be parsed.
27892790
27902791
If `usecols` is a list of integers, then it is assumed to be the file column
27912792
indices to be parsed.
2792-
27932793
.. code-block:: python
27942794
27952795
read_excel('path_to_file.xls', 'Sheet1', usecols=[0, 2, 3])
27962796
2797+
Element order is ignored, so usecols=[0,1] is the same as [1,0].
27972798

27982799
Parsing Dates
27992800
+++++++++++++

pandas/io/parsers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@
101101
be positional (i.e. integer indices into the document columns) or strings
102102
that correspond to column names provided either by the user in `names` or
103103
inferred from the document header row(s). For example, a valid array-like
104-
`usecols` parameter would be [0, 1, 2] or ['foo', 'bar', 'baz'].
104+
`usecols` parameter would be [0, 1, 2] or ['foo', 'bar', 'baz']. Element
105+
order is ignored, so usecols=[1,0] is the same as [0,1].
105106
106107
If callable, the callable function will be evaluated against the column
107108
names, returning names where the callable function evaluates to True. An

0 commit comments

Comments
 (0)