在处理csv文件时,发现这个出错,怎么办呢?

Traceback (most recent call last):
  File "pandas\_libs\parsers.pyx", line 1162, in pandas._libs.parsers.TextReader._convert_tokens (pandas\_libs\parsers.c:14858)
  File "pandas\_libs\parsers.pyx", line 1273, in pandas._libs.parsers.TextReader._convert_with_dtype (pandas\_libs\parsers.c:17119)
  File "pandas\_libs\parsers.pyx", line 1289, in pandas._libs.parsers.TextReader._string_convert (pandas\_libs\parsers.c:17347)
  File "pandas\_libs\parsers.pyx", line 1524, in pandas._libs.parsers._string_box_utf8 (pandas\_libs\parsers.c:23041)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 0: invalid continuation byte

During handling of the above exception, another exception occurred:

要解决这个问题,应该是CSV保存时有问题,需要把保存的代码进行修改:

原来: df.to_csv(outpath)

修改为: df.to_csv(outpath,  encoding= u'utf-8')

这样就可以按utf-8方式读取了。

Python游戏开发入门

http://edu.csdn.net/course/detail/5690

你也能动手修改C编译器

http://edu.csdn.net/course/detail/5582

纸牌游戏开发

http://edu.csdn.net/course/detail/5538

五子棋游戏开发

http://edu.csdn.net/course/detail/5487
RPG游戏从入门到精通
http://edu.csdn.net/course/detail/5246
WiX安装工具的使用
http://edu.csdn.net/course/detail/5207
俄罗斯方块游戏开发
http://edu.csdn.net/course/detail/5110
boost库入门基础
http://edu.csdn.net/course/detail/5029
Arduino入门基础
http://edu.csdn.net/course/detail/4931
Unity5.x游戏基础入门
http://edu.csdn.net/course/detail/4810
TensorFlow API攻略
http://edu.csdn.net/course/detail/4495
TensorFlow入门基本教程
http://edu.csdn.net/course/detail/4369
C++标准模板库从入门到精通 
http://edu.csdn.net/course/detail/3324
跟老菜鸟学C++
http://edu.csdn.net/course/detail/2901
跟老菜鸟学python
http://edu.csdn.net/course/detail/2592
在VC2015里学会使用tinyxml库
http://edu.csdn.net/course/detail/2590
在Windows下SVN的版本管理与实战 
http://edu.csdn.net/course/detail/2579
Visual Studio 2015开发C++程序的基本使用 
http://edu.csdn.net/course/detail/2570
在VC2015里使用protobuf协议
http://edu.csdn.net/course/detail/2582
在VC2015里学会使用MySQL数据库
http://edu.csdn.net/course/detail/2672

pandas读取出错:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 0相关推荐

  1. 报错:UnicodeDecodeError:: ‘utf-8‘ codec can‘t decode byte 0xc8 in position 0: invalid contin

    python读取数据时出现:UnicodeDecodeError:: 'utf-8' codec can't decode byte 0xc8 in position 0: invalid conti ...

  2. blender导入c4d obj模型出现UnicodeDecodeError:: ‘utf-8‘ codec can‘t decode byte 0xc8 in position 0:

    错误描述 blender导入c4d obj模型出现UnicodeDecodeError:: 'utf-8' codec can't decode byte 0xc8 in position 0 bal ...

  3. python 读取数据出现UnicodeDecodeError:: 'utf-8' codec can't decode byte 0xc8 in position 0: invalid contin

    之前写程序时也出现过类似错误,每次解决了到第二次遇见又忘了具体方法,这次记录一下. 一.字符编码问题 先介绍一下字符编码问题 1.ASCLL与GB2312 由于计算机是美国人发明的,因此,最早只有12 ...

  4. python 读取数据出现UnicodeDecodeError:: ‘utf-8‘ codec can‘t decode byte 0xc8 in position 0: invalid contin

    解决方法: 读取时也可以用二进制模式打开的文件(包括模式参数中的'rb')将内容作为字节对象,而不进行任何解码. 然后使用line.decode('utf-8',errors = 'ignore')解 ...

  5. Pandas读取中文文本文件报错:python ‘utf-8‘ codec can‘t decode byte 0xe3 in position 0: unexpected end of data

    近日用pandas的read_csv读取中文文本文件时报错:python 'utf-8' codec can't decode byte 0xe3 in position 0: unexpected ...

  6. python 读取文件报错:UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xb5 in position 0: invalid start

    python 读取文件报错:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 0: invalid start ...

  7. 【pd读取csv文件踩坑】读取csv文件时报错:UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xb5 in position 0

    写在前面: 由于CSDN的审查机制的原因,更多博客内容请访问我的个人博客或GitHub: 个人博客地址:个人博客 GitHub地址:GitHub 你是否有过之前用pd.read打开csv文件都正常,但 ...

  8. 【pandas问题】UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xca in position 0: invalid continuati

    出错位置: data = pd.read_csv('../data/user.csv') print(data.head()) 报错信息: UnicodeDecodeError: 'utf-8' co ...

  9. tensorflow 读取图片错误(error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0 )的解析

    在用tensorflow 自带的读取文件gfile模块中,调用API,如: filename = directory + DIRECTORY_IMAGES + name + '.jpg' image_ ...

最新文章

  1. Android Custom View系列《圆形菜单一》
  2. linux 进程参数文件 /proc/pid/cmdline 简介
  3. 2022最新款,官宣100000个跨年红包封面,直接领!!
  4. 二分查找(递归和非递归)
  5. cmd MySQL登录
  6. c/c++头文件函数一览表
  7. 制作CAB自解压文件的工具——IExpress
  8. HDP SandBox 安装与初步配置
  9. php oracle 存储过程 返回值,PHP 调用 Oracle 存储过程 之 查询
  10. 技巧:Eclipse阿里代码规范插件
  11. Lenovo y50-70 黑苹果hackintosh 10.14.4 Mojave 更新后开机黑屏,引导失败,无法开机
  12. 2020高考数学:常用知识点公式第四章(文科)
  13. 网路新年贺词_文伟_新浪博客
  14. SAM简单介绍(百度翻译)
  15. PyQt5自定义无边框窗口
  16. matlab中f分布,在matlab中用哪个函数求F分布的分位点(分子分母的自由度和概率均已知)...
  17. vue2和vue3中点击复制粘贴
  18. java学习笔记day09 final、多态、抽象类、接口
  19. MT6771/6761/6762 dconfig控制mrdump开关去除SOCID绑定
  20. python利用STMP发送gmail、QQ邮件错误及笔记总结

热门文章

  1. Windows系统,桌面创建.bat文件执行截图
  2. NVIDIA 7th SkyHackathon(四)Nemo ASR 模型训练与评估
  3. 通证经济系统设计的一个优秀范例——般若链
  4. 教务管理系统登录页面仿写
  5. uniApp的学习开发小程序(一)小程序基础搭建和基础部署
  6. linux系统grep命令匹配关键字前后几行内容
  7. 趋肤效应实验报告_大学计算机基础实验报告的答案
  8. 脑洞|手绘从零维到十维空间
  9. 前端资源 - 字体 - 学习/实践
  10. 【NLP】英文数据预处理___词干/词元处理