-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: allow usecols to be case insensitive #14154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
a better soln would be to allow
|
cc @gfyoung |
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 |
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
usecols
when 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.py
to case-transform the lists of column names before matching. This behaviour could be made the default, or it could be optional via anignore_col_case
keyword in the variousread
functions.The text was updated successfully, but these errors were encountered: