Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
ENH: allow usecols to be case insensitive #14154
Comments
|
a better soln would be to allow
|
|
cc @gfyoung |
jreback
added this to the
Next Major Release
milestone
Sep 5, 2016
|
yes a better error message would be nice as well. |
|
@jreback should passing a callable to |
|
no, it takes a single column and returns a boolean. These should match the names,
|
|
this would also easily allow #10882
though |
|
This indeed would be a nice enhancement! However, perhaps a better name (that would encompass everything) would be |
|
@jreback I'll need a few days to make all these changes. In the meantime, are you interested in a PR that just updates the error message? |
|
sure a separate PR for the error message would be be great |
aechase commentedSep 5, 2016
I have a wide delimited file that includes columns with predictable names but unpredictable capitalisation, as shown in this toy code.
I want to pass a list of column names to
usecolswhen importing the file, but I won't be able to unless I match the names exactly:I see two problems here. First, the error text would be more helpful if it specified what column name(s) is/are wrong. That's pretty easy to fix. Second, if I know that capitalisation might be a problem, I have to check every column name individually before I can pass a list to
usecols. One possible solution would be to modify this part and this part ofparsers.pyto case-transform the lists of column names before matching. This behaviour could be made the default, or it could be optional via anignore_col_casekeyword in the variousreadfunctions.