Skip to content
Advertisement

Read excel file in python using pandas

I am trying to read excel file in pycharm using pandas. I installed the package successfully. My issue is that I am trying to use file location in addition to its name I tried many thing as follow:

JavaScript

However I keep receiving the following error

JavaScript

Any Idea?

Thanks in advance

Advertisement

Answer

Your fileLocation variable includes the name of the file. reading fileLocation + fileName is essentially reading

C:\Users\GTS\Desktop\Network Interdiction Problem\Manuscript\Interdiction_Data.xlsxInterdiction_Data.xlsx

Another issue is that you have quotation marks around your variable names when calling pd.read_excel() meaning that you are passing a string to the function.

Try:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement