Home > Enterprise >  How to find a file in Python Pandas
How to find a file in Python Pandas

Time:10-19

I'm confused. Not used Pandas in a few years but tried to used standard:

import pandas as pd

df = pd.read_excel("blah.xlsx")

Just getting FileNotFoundError: [Errno 2] No such file or directory: 'blah.xlsx'

I'm using Mac Osx (Big Sur) and Python 3.9. Tried moving, copying the file to same direcory, but still same error. What do I do?

CodePudding user response:

First list the files using

import os
print(os.listdir())

maybe the file is blah.xls not blah.xlsx

CodePudding user response:

Try to add the path to the file:

import pandas as pd
df = pd.read_excel(r'Users/Your_mama/Downloads/blah.xlsx')
  • Related