pandas-dev / pandas

Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
https://pandas.pydata.org
BSD 3-Clause "New" or "Revised" License
43.74k stars 17.95k forks source link

Unify error messages when opening inexistent excel/csv file #29125

Open nottatdat opened 5 years ago

nottatdat commented 5 years ago

Similar to https://github.com/pandas-dev/pandas/issues/29102, excel and csv file extensions now have inconsistent errors for nonexistent files.

import pandas as pd
pd.read_csv('file_1.csv')
IOError: [Errno 2] File file_1.csv does not exist: 'file_1.csv'

pd.read_excel('file_2.xlsx')
IOError: [Errno 2] No such file or directory: 'file_2.xlsx'

Would be better to have a uniform error message across multiple file extensions, like the one with json in https://github.com/pandas-dev/pandas/pull/29104:

FileNotFoundError: File 'no_file.json' does not exist
nottatdat commented 5 years ago

I'm more than happy to contribute to this issue!

mohitanand001 commented 5 years ago

Hi @tataudat, I have already started to work on the issue, when I identified that in this comment https://github.com/pandas-dev/pandas/pull/29104#issuecomment-544223710