nucsit026
nucsit026

Reputation: 720

How to read python file using WSL?

I have an exported file from python 3.7 (python installed in windows 10, under anaconda3), I want to read this file using jupyter notebook and python 3.6.9 (python installed via WSL - Windows Subsystem for Linux) I used:

df = pd.read_csv(r"D:\Data\CSV_file.csv", sep = ",",header = None,engine = "python")

But I got an error:

FileNotFoundError: [Errno 2] No such file or directory: 'D:\Data\CSV_file.csv'

I tried (csv,xlsx) formats but I had the same error. the paths of two files are (/home/user_name for python 3.6.9 and C:\Users\user_name for python 3.7). How can I read this file using jupyter notebook?

Upvotes: 2

Views: 6204

Answers (1)

user12055579
user12055579

Reputation: 762

You have to use Linux file paths because it is acting like the Linux OS. Change r"D:\Data\CSV_file.csv" to r"/mnt/d/Data/CSV_file.csv" since /mnt/d is equivalent of D:.

Upvotes: 3

Related Questions