Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Improve the error message when `usecols` cannot match all columns #17301
import pandas as pd # Where example.csv is: # column1,column2 # 1, 2 pd.read_csv('example.csv', usecols=['column1', 'column2', ' column3'])
The error when all of the columns provided in usecols are not found isn't currently very useful. I think it would be much better if it detailed which fields it could not find - this is really useful when you're reading a large file with many required columns.
A ValueError with the fields that are missing, something like: