Bakwaas 123
Bakwaas 123

Reputation: 1

unable to read csv file on jupyter notebook

import pandas as pd
import os
df=pd.read_csv(r"C:/Users/tom/Desktop/misc/number-of-motor-vehicles-2018-census-csv.csv")
df

the above 4 lines are my code and im getting the error as shown below

FileNotFoundError: [Errno 2] File C:/Users/tom/Desktop/misc/number-of-motor-vehicles-2018-census- 
 csv.csv does not exist: 'C:/Users/tom/Desktop/misc/number-of-motor-vehicles-2018-census-csv.csv'

i tried removing "r" i tried front and back slash single and double quotes...plz help me out

Upvotes: 0

Views: 86

Answers (1)

T139
T139

Reputation: 140

Have you made sure that the file does not have a second extension (possibly .txt)? This might happen when e.g. saving a file with Notepad and appending .csv to the file name but disregarding the dropdown box "Save as type" ...

You could try

  • go to the “View” tab on the ribbon in Windows Explorer and activate the “File name extensions” box in the Show/hide section
  • hit Win+R, type 'cmd' and try Dir C:\Users\tom\Desktop\misc\
  • use the function os.listdir(r'C:\Users\Tobi\Desktop\misc') in python

Upvotes: 1

Related Questions