From 0b3c0def50a882b779c1ad2f82feca820155532b Mon Sep 17 00:00:00 2001 From: Ignacio Martinez Vazquez Date: Mon, 11 Dec 2017 14:13:13 -0300 Subject: [PATCH] DOC: read_csv usecols element order is ignored --- doc/source/io.rst | 5 +++-- pandas/io/parsers.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/source/io.rst b/doc/source/io.rst index 54e7a11c5f2b1..01ac9517cddc0 100644 --- a/doc/source/io.rst +++ b/doc/source/io.rst @@ -131,7 +131,8 @@ usecols : array-like or callable, default ``None`` be positional (i.e. integer indices into the document columns) or strings that correspond to column names provided either by the user in `names` or inferred from the document header row(s). For example, a valid array-like - `usecols` parameter would be [0, 1, 2] or ['foo', 'bar', 'baz']. + `usecols` parameter would be [0, 1, 2] or ['foo', 'bar', 'baz']. Element + order is ignored, so usecols=[0,1] is the same as [1, 0]. If callable, the callable function will be evaluated against the column names, returning names where the callable function evaluates to True: @@ -2822,11 +2823,11 @@ to be parsed. If `usecols` is a list of integers, then it is assumed to be the file column indices to be parsed. - .. code-block:: python read_excel('path_to_file.xls', 'Sheet1', usecols=[0, 2, 3]) +Element order is ignored, so usecols=[0,1] is the same as [1,0]. Parsing Dates +++++++++++++ diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index a04d77de08950..adfcaf43a92a5 100755 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -101,7 +101,8 @@ be positional (i.e. integer indices into the document columns) or strings that correspond to column names provided either by the user in `names` or inferred from the document header row(s). For example, a valid array-like - `usecols` parameter would be [0, 1, 2] or ['foo', 'bar', 'baz']. + `usecols` parameter would be [0, 1, 2] or ['foo', 'bar', 'baz']. Element + order is ignored, so usecols=[1,0] is the same as [0,1]. If callable, the callable function will be evaluated against the column names, returning names where the callable function evaluates to True. An