原因
python3读取csv文件的默认编码为unicode,unicode并不是编码格式,而是字符集,它包含了世界上目前所有的符号,所以unicode没有decode属性
encode,decode,分别是编码和解码,在Python中,unicode类型是编码的基础类型
解决办法
在read_csv的后面加上.astype(str)
data = pd.read_csv('route/filename.csv').astype(str)
python3读取csv文件的默认编码为unicode,unicode并不是编码格式,而是字符集,它包含了世界上目前所有的符号,所以unicode没有decode属性
encode,decode,分别是编码和解码,在Python中,unicode类型是编码的基础类型
在read_csv的后面加上.astype(str)
data = pd.read_csv('route/filename.csv').astype(str)
本文标题:Pandas读取csv文件出现,AttributeError:'
本文链接:https://www.haomeiwen.com/subject/pkbrfktx.html
网友评论