python 使用read_csv读取 CSV 文件时报错
读取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 文件时报错的更多相关文章
- 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 ...
- Selenium(Python) ddt读取CSV文件数据驱动
import csvimport unittestfrom time import sleep from ddt import ddt, data, unpackfrom selenium impor ...
- 用 Scanner 扫描CSV文件时报错:“java.util.nosuchelementexception:no line found”的解决方法
最近用 java 对一个很大的 CSV 文件进行处理.打算用 Scanner 逐行扫描进来,结果报错 "java.util.nosuchelementexception:no line fo ...
- [解决问题] pandas读取csv文件报错OSError解决方案
python用padans.csv_read函数出现OSError: Initializing from file failed 问题:文件路径中存在中文 解决办法:修改文件路径名为全英文包括文件名
- python之模块csv之 读取CSV文件(reader和DictReader2个方法)
# -*- coding: utf-8 -*- #python 27 #xiaodeng #读取CSV文件(reader和DictReader2个方法) import csv #csv文件,是一种常用 ...
- 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 ...
- 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 ...
- [Python Study Notes]pd.read_csv()函数读取csv文件绘图
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ...
- python 读取文件时报错UnicodeDecodeError
python 读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multib ...
随机推荐
- 基于CoreText的基础排版引擎之不带图片的排版引擎
- (void)drawRect:(CGRect)rect { [super drawRect:rect]; //步骤一:得到当前绘制画布上下文,用于后续将内容绘制在画布上 CGContextRef ...
- arcgis如何求两个栅格数据集的差集
栅格数据集没有擦除功能,现在有栅格A和栅格B,怎么求两个栅格的差集C 具体步骤如下: 1.首先利用栅格计算器,把栅格B中的value全部赋值为0 输入语句:"栅格B" * 0 2 ...
- python第四十五课——继承性之多继承
测试模块 演示多继承的结构和使用: 子类:Child 直接父类(多个):Father.Mother 注意: 由于有多个直接父类,多个父类都要自己给其属性赋值, 避免混淆,我们使用类名.__init__ ...
- CSS3中和动画有关的属性transform、transition 和 animation
CSS3中和动画有关的属性有三个 transform. transition 和 animation.下面来一一说明: transform 从字面来看transform的释义为 ...
- JS进阶之---作用域,作用域链,闭包
一.作用域: 在JavaScript中,我们可以将作用域定义为一套规则,这套规则用来管理引擎如何在当前作用域以及嵌套的子作用域中根据标识符名称进行变量查找.这里的标识符,指的是变量名或者函数名. Ja ...
- ECS API
一.API调用方式 ➢对ECS API接口调用是通过向ECS API的服务端地址发送HTTP GET请求,并按照接口说明在请求 中加入相应请求参数来完成的;根据请求的处理情况,系统会返回处理结果. ➢ ...
- Linux 性能分析工具汇总合集
出于对Linux操作系统的兴趣,以及对底层知识的强烈欲望,因此整理了这篇文章.本文也可以作为检验基础知识的指标,另外文章涵盖了一个系统的方方面面.如果没有完善的计算机系统知识,网络知识和操作系统知识, ...
- 关于mysql中字符集和排序规则说明
文章转自 http://blog.csdn.net/smallSBoy/article/details/52997138 数据库需要适应各种语言和字符就需要支持不同的字符集(Character Set ...
- 剑指offer从上往下打印二叉树 、leetcode102. Binary Tree Level Order Traversal(即剑指把二叉树打印成多行、层序打印)、107. Binary Tree Level Order Traversal II 、103. Binary Tree Zigzag Level Order Traversal(剑指之字型打印)
从上往下打印二叉树这个是不分行的,用一个队列就可以实现 class Solution { public: vector<int> PrintFromTopToBottom(TreeNode ...
- ubuntu 安装json
命令行中输入:sudo apt-get install libjsoncpp-dev