Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URLError: urlopen error [Errno 2] No such file or directory

Tags:

python

pandas

I was perfectly able to use pandas read_csv for reading files in Windows. However I cannot figure out how to set local path in Ubuntu?

If I do this:

data = pd.read_csv(r'file://home/gosper/Desktop/test.csv')

... it throws the error: URLError: <urlopen error [Errno 2] No such file or directory

like image 630
Klue Avatar asked Sep 02 '25 04:09

Klue


1 Answers

this should work for Windows's and UNIX's Desktop folder:

data = pd.read_csv(os.path.expanduser('~') + '/Desktop/test.csv')
like image 93
MaxU - stop WAR against UA Avatar answered Sep 04 '25 17:09

MaxU - stop WAR against UA