转:https://blog.csdn.net/funnyPython/article/details/78532102

rides = pd.read_csv(data_path)1
# OSError Traceback (most recent call last)
<ipython-input-48-4b01f471424e> in <module>()
----> 1 rides = pd.read_csv(data_path)
c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\pandas\io\parsers.py in parser_f(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, escapechar, comment, encoding, dialect, tupleize_cols, error_bad_lines, warn_bad_lines, skipfooter, skip_footer, doublequote, delim_whitespace, as_recarray, compact_ints, use_unsigned, low_memory, buffer_lines, memory_map, float_precision)
    703                     skip_blank_lines=skip_blank_lines)
    704
--> 705         return _read(filepath_or_buffer, kwds)
    706
    707     parser_f.__name__ = name
c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\pandas\io\parsers.py in _read(filepath_or_buffer, kwds)
    443
    444     # Create the parser.
--> 445     parser = TextFileReader(filepath_or_buffer, **kwds)
    446
    447     if chunksize or iterator:
c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\pandas\io\parsers.py in __init__(self, f, engine, **kwds)
    812             self.options['has_index_names'] = kwds['has_index_names']
    813
--> 814         self._make_engine(self.engine)
    815
    816     def close(self):
c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\pandas\io\parsers.py in _make_engine(self, engine)
   1043     def _make_engine(self, engine='c'):
   1044         if engine == 'c':
-> 1045             self._engine = CParserWrapper(self.f, **self.options)
   1046         else:
   1047             if engine == 'python':
c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\pandas\io\parsers.py in __init__(self, src, **kwds)
   1682         kwds['allow_leading_cols'] = self.index_col is not False
   1683
-> 1684         self._reader = parsers.TextReader(src, **kwds)
   1685
   1686         # XXX
pandas\_libs\parsers.pyx in pandas._libs.parsers.TextReader.__cinit__()
pandas\_libs\parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()
OSError: Initializing from file failed1234567891011121314151617181920212223242526272829303132333435363738394041424344
 
解决方案:
1.把当前路径中的中文改成英文。
2.cd到你的csv文件目录下,然后直接打开csv文件。

(转)pd.read_csv之OSError: Initializing from file failed的解决方案的更多相关文章

  1. 处理 read_csv 报错 OSError:Initializing from file failed

    1.问题发现 df=pd.read_csv("X-go报表_交易20191118.csv") print(df.info()) File "pandas/_libs/pa ...

  2. pandas.read_csv() 报错 OSError: Initializing from file failed,报错原因分析和解决方法

    今天调用pandas读取csv文件时,突然报错“ OSError: Initializing from file failed ”,我是有点奇怪的,以前用的好好的,read_csv(path)方法不是 ...

  3. read_csv报错Initializing from file failed

    Python版本:Python 3.6 pandas.read_csv() 报错 OSError: Initializing from file failed,一般由两种情况引起:一种是函数参数为路径 ...

  4. python 读取文件read.csv报错 OSError: Initializing from file failed

    小编在用python 读取文件read.csv的时候 报了一个错误 OSError: Initializing from file failed 初始化 文件失败 检查了文件路径,没问题 那应该是我文 ...

  5. pd.read_csv() 、to_csv() 之 常用参数

    本文简单介绍一下read_csv()和 to_csv()的参数,最常用的拿出来讲,较少用的请转到官方文档看. 一.pd.read_csv() 作用:将csv文件读入并转化为数据框形式. pd.read ...

  6. pd.read_csv的header用法

    默认Header = 0: In [3]: import pandas as pd In [4]: t_user = pd.read_csv(r'C:\Users\Song\Desktop\jdd_d ...

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

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

  8. pd.read_csv参数解析

    对pd.read_csv参数做如下解释: pandas.read_csv(filepath_or_buffer, sep=', ', delimiter=None, header='infer', n ...

  9. 使用read、readline、readlines和pd.read_csv、pd.read_table、pd.read_fwf、pd.read_excel获取数据

    从文本文件读取数据 法一: 使用read.readline.readlines读取数据 read([size]):从文件读取指定的字节数.如果未给定或为负值,则去取全部.返回数据类型为字符串(将所有行 ...

随机推荐

  1. vue组件兄弟间通信

    四.兄弟组件间通信(event) 借助于一个公共的Vue的实例对象,不同的组件可以通过该对象完成事件的绑定和触发 var bus = new Vue(); bus.$emit()bus.$on() 熊 ...

  2. spring-data-elasticsearch使用出现的一些小问题

    问题一failed to load elasticsearch nodes : org.elasticsearch.index.mapper.MapperParsingException: No ty ...

  3. 剑指offer--day01

    1.1题目:二维数组中的查找:在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序.请完成一个函数,输入这样的一个二维数组和一个整数,判断 ...

  4. 006/搭建fabric(二)

    准备vmware虚拟机,并安装完ubuntu系统后.继续搭建fabric运行环境... 0.打开终端,切换root身份.目的:后续操作即可不用sudo... 右键->open Terminal- ...

  5. spring boot 将对象转换为json返回

    Spring Boot默认使用Jackson将对象转换为json,需要配置以下依赖: compile group: 'com.fasterxml.jackson.core', name: 'jacks ...

  6. synchronized的底层实现原理

    转自:http://www.cnblogs.com/paddix/p/5367116.html 如果对上面的执行结果还有疑问,也先不用急,我们先来了解Synchronized的原理,再回头上面的问题就 ...

  7. [Python3 填坑] 018 组装类的几个例子

    目录 1. print( 坑的信息 ) 2. 开始填坑 2.1 MetaClass 举例 2.2 type 举例 2.3 MetaClass 举例 1. print( 坑的信息 ) 挖坑时间:2019 ...

  8. SCUT - 153 - 小马哥和他的山脉 - 线段树

    https://scut.online/p/153 其实不需要用线段树,只关心相邻元素的差,像神仙那样用差分就可以O1维护的. 但是我偏要用. 交之前写的那个,注意没有st本身的线段树只有lazy标记 ...

  9. Vue组件通信方式(一)

    组件与组件的关系,通常有父子关系,兄弟关系以及隔代关系. 针对不同的场景,如何选用适合的通信方式呢? (一) props/$emit parentComponent ==> childCompo ...

  10. meter标签度量衡如何改变颜色

    此文章为转载,目的为了方便整理学习笔记. 在meter中要想改变颜色,需要用到五个值,分别是:min(最小值).max(最大值).low.high.value和optimum,其中前四个值会把整个进度 ...