Reputation: 385
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
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
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
Reputation: 4827
You can try:
from pathlib import Path
pd.read_csv(Path("User/Documents/etc/file.csv"))
Upvotes: 2