L2_unable to access csv file locally

i am trying to access csv locally but gettig "FileNotFoundError ". any thoughts ?

os.makedirs(“data”,exist_ok=True)

file_url = “…/users//downloads/all-states-history.csv”
df = pd.read_csv(‘file_url’).fillna(value = 0)

Well, you can’t put file_url into quotes when calling read_csv. It’s a variable that contains either URL or the path to the file.

You can use this to test for the presence of the file:

import os

if os.path.isfile(file_path):
    print("File exists and is a regular file!")
else:
    print("File does not exist or is not a file.")
1 Like