Pandas导入CSV文件,出现下面的报错信息。

/usr/local/lib/python3.5/dist-packages/pandas/io/parsers.py in __init__(self, src, **kwds)1706         kwds['usecols'] = self.usecols1707
-> 1708         self._reader = parsers.TextReader(src, **kwds)1709 1710         passed_names = self.names is Nonepandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.__cinit__()pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._get_header()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 0: invalid start byte

解决办法

方法1,使用unicode_escape编码

dataset = pd.read_csv('sample_data.csv',encoding = 'unicode_escape')

方法2,使用ISO-8859-1编码

import sys
reload(sys)
sys.setdefaultencoding("ISO-8859-1")

方法2,跳过错误

a.encode('utf-8').strip()

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 0: invalid start byte解决办法相关推荐

  1. python错误:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 0: invalid start byte

    python错误:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 0: invalid start byte解 ...

  2. UnicodeDecodeError: 'utf8' codec can't decode byte 0xb1 in position 0: invalid start byte

    在Python处理字符编码时出现如下错误: UnicodeDecodeError: 'utf8' codec can't decode byte 0xb1 in position 0: invalid ...

  3. 解决UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte问题

    此文首发于我的个人博客:解决UnicodeDecodeError 'utf-8' codec can't decode byte 0xff in position 0 invalid start by ...

  4. UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xb0 in position 0: invalid start byte

    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 0: invalid start byte

  5. 成功解决UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9a in position 0: invalid start byte

    成功解决UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9a in position 0: invalid start byte 目录 解决 ...

  6. UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc7 in position 0: invalid continuation byte

    [写在前面] 今天在做说stm32和服务器之间的通信时因为编码格式问题导致了一些错误做个记录: 测试时搭载在云服务器上的python socket通讯模块数据接收部分代码如下: receive_dat ...

  7. UnicodeDecodeError: 'utf8' codec can't decode byte 0xd1 in position 0: invalid continuation byte问题

    在用python编码的时候,想把一txt文件里面的东西,插入到excel表格中,结果出现了UnicodeDecodeError: 'utf8' codec can't decode byte 0xd1 ...

  8. 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 ...

  9. UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xb5 in position 2: invalid start byte

    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 2: invalid start byte 解决: 将phen ...

最新文章

  1. Windows平台搭建-----C语言
  2. 【H.264】x264命令详解:x264 --fullhelp
  3. 艾伟也谈项目管理,在团队中如何推行一项新的实践
  4. ToString()的格式设置
  5. Eclipse 高亮显示
  6. 吉林电子计算机学校学费多少,收费标准_吉林工商学院学费介绍_高考院校库
  7. 【译】Celeste 手感的 10 个设计细节
  8. [导入]Dreamweaver插入Flash参数
  9. JavaOne大事纪:IBM谈OpenJ9和Open Liberty
  10. AlgorithmMan,一套免费的算法演示神器
  11. mysql char(36)_MySQL中char(36)被认为是GUID导致的BUG及解决方案
  12. Java并发编程:同步容器
  13. 报表开发导出各种格式文件的API
  14. 查看IIS进程所对应的应用程序池名称
  15. html5在线聊天模板,h5聊天室模板|仿微信聊天室html5
  16. 高频电子线路——串联谐振、并联谐振总结
  17. 5G牌照今日发放!!!
  18. python接入支付宝 40004 invalid-signature 错误原因: 验签出错
  19. R语言可视化散点图、ggrepel包的geom_text_repel函数避免数据点之间的标签互相重叠(设置segment.square为假以获得斜曲线,segment.inflect设置为真以引入拐点
  20. 行业最常见的7种AGV导航系统方式

热门文章

  1. 学习英文-学以致用【场景:程序员英文-开发环境】
  2. 树莓派Raspberry Pi上手报告
  3. 2016蓝桥杯b组java试题及答案_2016年第七届蓝桥杯java B组省赛试题
  4. 抖音表情包项目怎么变现?普通人如何利用表情包短视频月入过万?
  5. 50 行代码爬取链家租房信息
  6. 第十四届蓝桥杯第一期模拟赛 python
  7. 杂谈eMule协议的由来
  8. Python_pandas读取数据
  9. 2020北京国际金融安全论坛(二)
  10. 万年历、黄历,获取每日的宜忌、五行、冲煞、值神、彭祖百忌、吉神宜趋、今日胎神、凶神宜忌、二十八星宿、建除十二神