Bax Menker
Bax Menker

Reputation: 41

How to read a csv file from local network with pandas

I would like to read the csv file from 192.168.214.241/data/myfile.csv

When I do

data = pd.read_csv('//192.168.214.241/data/myfile.csv')

I get the error:

FileNotFoundError: File b'//192.168.214.241/data/myfile.csv' does not exist

The file exists though. Does anyone have an idea how I can solve this?

EDIT: Actually I might have a rights problem. When I access the folder via the Windows GUI I have to enter username and password. Can I account or that with pd.read_csv()?

EDIT 2: I used another PC and it worked. Non pandas/python related problem. Thanks for all the help though!

Upvotes: 1

Views: 6779

Answers (2)

RomanPerekhrest
RomanPerekhrest

Reputation: 92884

Use file URI format:

data = pd.read_csv('://192.168.214.241/data/myfile.csv')

or

data = pd.read_csv('file://192.168.214.241/data/myfile.csv')

Upvotes: 1

davo777
davo777

Reputation: 336

try this to see what directory you're currently in:

import os
print(os.getcwd())
print(os.listdir())

your code looks fine so you're probably just in the wrong place.

Upvotes: 2

Related Questions