[英]Syntax error while reading csv file through python?
Tried multiple ways to read CSV file but it always throws syntax error.尝试了多种读取 CSV 文件的方法,但总是抛出语法错误。 When I am not using
r
in this code, code looks like当我不在这段代码中使用
r
时,代码看起来像
import pandas
df = pandas.read_csv(r "c:\week3data.csv")
SyntaxError: invalid syntax
It is possible the file is encoded in a different format:该文件可能以不同的格式编码:
Try尝试
import pandas
df = pandas.read_csv("c:\week3data.csv", ,encoding="latin-1")
or或者
import pandas
df = pandas.read_csv("c:\week3data.csv", encoding="ISO-8859-1")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.