I am currently struggling to import an excel-csv file to python. I'm sure my problem is very easy to solve, but I'm quite new to programming in python.
The code I used:
train1 = pd.read_csv(r"D:\Foldername1\Foldername2\data.csv")
Then I get this kind of error:
File "pandas\_libs\parsers.pyx", line 697, in pandas._libs.parsers.TextReader._setup_parser_source
OSError: Initializing from file failed
I thought about the need to add something like sep=',' but this didn't work either. So I'm kinda helpless at the moment. Thank you very much already! :)
try this,
train1 = pd.read_csv(r"D:\Foldername1\Foldername2\data.csv", engine='python')
If raises Permission denied, then give read permission to your file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.