读取csv文件时报错

df = pd.read_csv('c:/Users/NUC/Desktop/成绩.csv' )

Traceback (most recent call last):
  File "D:/学习/helloworld/helloworld.py", line 268, in <module>
    df = pd.read_csv('c:/Users/NUC/Desktop/成绩.csv' )
  File "D:\学习\Python\Python-3.6.5\lib\site-packages\pandas\io\parsers.py", line 678, in parser_f
    return _read(filepath_or_buffer, kwds)
  File "D:\学习\Python\Python-3.6.5\lib\site-packages\pandas\io\parsers.py", line 440, in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
  File "D:\学习\Python\Python-3.6.5\lib\site-packages\pandas\io\parsers.py", line 787, in __init__
    self._make_engine(self.engine)
  File "D:\学习\Python\Python-3.6.5\lib\site-packages\pandas\io\parsers.py", line 1014, in _make_engine
    self._engine = CParserWrapper(self.f, **self.options)
  File "D:\学习\Python\Python-3.6.5\lib\site-packages\pandas\io\parsers.py", line 1708, in __init__
    self._reader = parsers.TextReader(src, **kwds)
  File "pandas\_libs\parsers.pyx", line 384, in pandas._libs.parsers.TextReader.__cinit__
  File "pandas\_libs\parsers.pyx", line 697, in pandas._libs.parsers.TextReader._setup_parser_source
OSError: Initializing from file failed

解决:

df = pd.read_csv('c:/Users/NUC/Desktop/成绩.csv', engine='python' )
加上 engine = 'python'
engine的参数有三个 'c','python','python_fwf'

python 使用read_csv读取 CSV 文件时报错的更多相关文章

  1. python读取txt文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x8e in position 8: illegal multibyte sequence

    python读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x8e in position 8: illegal multibyte ...

  2. Selenium(Python) ddt读取CSV文件数据驱动

    import csvimport unittestfrom time import sleep from ddt import ddt, data, unpackfrom selenium impor ...

  3. 用 Scanner 扫描CSV文件时报错:“java.util.nosuchelementexception:no line found”的解决方法

    最近用 java 对一个很大的 CSV 文件进行处理.打算用 Scanner 逐行扫描进来,结果报错 "java.util.nosuchelementexception:no line fo ...

  4. [解决问题] pandas读取csv文件报错OSError解决方案

    python用padans.csv_read函数出现OSError: Initializing from file failed 问题:文件路径中存在中文 解决办法:修改文件路径名为全英文包括文件名

  5. python之模块csv之 读取CSV文件(reader和DictReader2个方法)

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #读取CSV文件(reader和DictReader2个方法) import csv #csv文件,是一种常用 ...

  6. python 读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multib

    python 读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multib ...

  7. Python读取CSV文件,报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0xa7 in position 727: illegal multibyte sequence

    Python读取CSV文件,报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0xa7 in position 727: illegal mul ...

  8. [Python Study Notes]pd.read_csv()函数读取csv文件绘图

    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ...

  9. python 读取文件时报错UnicodeDecodeError

    python 读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multib ...

随机推荐

  1. i.s.h.med Enhancement for cancelling an appointment

    This article intends to introduce my experience about enhancement for canceling an appointment. I tr ...

  2. 【 nginx 】怎么安装nginx

    一,下载地址:http://nginx.org/en/download.html 二,下载完成之后,是一个安装包,解压之后就能直接使用 三,点击进去我们刚刚解压好的nginx的安装包,打开nginx. ...

  3. 管道流_PipedInputStream与PipedOutputStream

    输入和输出可以直接进行连接,通过结合线程使用(一个线程用于写,另一个用于读,因为管道输入流(读)是要读取管道输出流的数据的,又因为输入流中的read方法是阻塞式的,当两个流在同一个线程中时,输入流的r ...

  4. 机器C盘临时区

    系统的临时区里:C:\Documents and Settings\Administrator(用户名)\Local Settings\Temporary Internet Files 这是临时文件夹 ...

  5. Scrapy运行流程

    接下来的图表展现了Scrapy的架构,包括组件及在系统中发生的数据流的概览(绿色箭头所示). 下面对每个组件都做了简单介绍,并给出了详细内容的链接.数据流如下所描述. 来源于https://scrap ...

  6. MyCat不适用场景(使用时避免)

    1.非分片字段查询 Mycat中的路由结果是通过分片字段和分片方法来确定的.例如下图中的一个Mycat分库方案: ·        根据 tt_waybill 表的 id 字段来进行分片 ·      ...

  7. kafka监控kafka-eagle 容器化配置

    由于kafka.zk 集群已经部署在k8s中,  kafka的服务名 kafka-hs, zk的服务名为:zk-cs ,对kafka进行监控,所以需要把监控部署到k8s中,选择使用kafka-eagl ...

  8. oracle全量、增量备份

    采用0221222增量备份策略,7天一个轮回 也就是周日0级备份,周1 2 4 5 6 采用2级增量备份,周3采用1级增量备份 打开控制文件自动备份 CONFIGURE CONTROLFILE AUT ...

  9. 静态分析Android程序

    快速定位Android程序的关键代码 1.通过apktool反编译apk文件,得到AndroidManifest.xml文件,可以得到程序用到的组建.配置.以及主Activity 2.信息反馈法(特殊 ...

  10. AI 随机梯度下降(SGD)

    随机梯度下降(stochastic gradient descent) 梯度是期望 计算梯度耗时太长