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 ...
随机推荐
- Python getting started guide
Get up in the morning. The first thing is to write a blog, although it uses machine translation, it ...
- Hibernate Tools生成注释
原文:http://www.blogjava.net/pauliz/archive/2009/11/13/302162.html 有同学需要修改后的Hibernate Tools整个tool我就不上传 ...
- Mysql优化_慢查询开启说明及Mysql慢查询分析工具mysqldumpslow用法讲解
Mysql优化_慢查询开启说明及Mysql慢查询分析工具mysqldumpslow用法讲解 Mysql慢查询开启 Mysql的查询讯日志是Mysql提供的一种日志记录,它用来记录在Mysql中响应 ...
- (2)HomeAssistant 参数配置
如果你希望使用其它目录作为配置文件所在地,可以使用以下命令启动home assistant:hass --config path/to/config 在配置目录下,有一个文件configuration ...
- 如何使用bootstrap框架
Bootstrap是前端工程师比较常用的框架.插件,根据它的定义,Bootstrap就是用于前端开发的一个模板,就是别人做好了我们直接可以搬过来直接使用或者根据自己需要略加修改设计自己的页面效果的成品 ...
- day14 Python百分号字符串拼接
拼接 # -*- coding:utf8 -*- #%s字符串,%d数字msg = '%s am %s my %s is %s'% (2,"charon","pluto& ...
- 淘宝可伸缩高性能互联网架构HSF(转)
文章转自http://blog.csdn.net/hpf911/article/details/14165865 时间过得很快,来淘宝已经两个月了,在这两个月的时间里,自己也感受颇深.下面就结合淘宝目 ...
- https://leetcode.com/problems/palindromic-substrings/description/
https://www.cnblogs.com/grandyang/p/7404777.html 博客中写的<=2,实际上<=1也是可以的 相当于判断一个大指针内所有子字符串是否可能为回文 ...
- PAT A1034 Head of a Gang (30 分)——图遍历DFS,字符串和数字的对应保存
One way that the police finds the head of a gang is to check people's phone calls. If there is a pho ...
- PAT A1029 Median (25 分)——队列
Given an increasing sequence S of N integers, the median is the number at the middle position. For e ...