Home > Mobile >  Jupyter Notebook/Pandas not reading excel file after moving ipynb
Jupyter Notebook/Pandas not reading excel file after moving ipynb

Time:11-18

I'm working on automating some reporting for work which starts off with a pd.read_excel method. It worked fine and I moved on with the rest of my code. When I was done, I had a few ipynb files on my desktop and moved them into a folder called "Python". After doing so, I'm getting a "No such file or directory" error when rerunning the code. The file is in a folder called "Reporting". I can leave them on the desktop for now, but typically have everything organized in folders to avoid clutter. What do I need to do to get my code to continue read in the excel files?

    RawData=pd.read_excel("Reporting/LS_Questions.xlsx",skiprows=2)

CodePudding user response:

Try using an absolute path rather than a relative path. Right now your path assumes that the file is within the same directory as the notebook. you can either:

  1. use a full path a.i - "C:\User{user_name}\Desktop\LS_Questions.xlsx"
  2. Move the CSV/XL file to the directory of the notebook.
  • Related