Mike
Mike

Reputation: 385

I cannot read csv file as pandas dataframe (anymore)

I have just changed laptop (from Windows to Mac) and after reinstalling anaconda/spyder I have tried to run the same code that reads a csv file as a pandas dataframe.

I have been using: pd.read_csv (path file)

pd.read_csv("/User/Documents/etc...csv")

but the code gets stuck. It runs for several minutes and afterwards the console displays:

"Errno 5" Input/output error: '/User/Documents/....'.

Do you have an idea of which reason could be behind this?

Upvotes: 0

Views: 5147

Answers (3)

Shiva Manhar
Shiva Manhar

Reputation: 703

I think your csv file is not correct format. May be use a spacial character. so you can try this code.

pd.read_csv("/User/Documents/etc...csv", encoding = "ISO-8859-1") 

Upvotes: 1

KHURRAM
KHURRAM

Reputation: 19

use two forward // instead of one like this import pandas as pd df=pd.read_csv("C//User/Documents/etc..//filename.csv")

Upvotes: 0

René
René

Reputation: 4827

You can try:

from pathlib import Path
pd.read_csv(Path("User/Documents/etc/file.csv"))

Upvotes: 2

Related Questions