转: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. python中的包和文件夹的区别

    python的模块,就不得不说包(package),package是module的集合,在一个package中有很多的module, 还是以之前的index.py与baiduHq.py模块为案例,说明 ...

  2. 【EWM系列】SAP EWM Warehouse Order Creation

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[EWM系列]SAP EWM Warehouse ...

  3. Lowest Common Ancestor of a Binary Tree(二叉树公共祖先)

    来源:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree Given a binary tree, find t ...

  4. <每日一题>Day 9:POJ-3281.Dining(拆点 + 多源多汇+ 网络流 )

    Dining Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 24945   Accepted: 10985 Descript ...

  5. [BZOJ5099]Pionek

    Description 给 \(n\) (\(n\le 2\times 10 ^5\)) 个向量,现在你在 \((0,0)\) ,选择一些向量使你走的最远. Solution 自己的想法:按极角排序后 ...

  6. CodeForces 877E DFS序+线段树

    CodeForces 877E DFS序+线段树 题意 就是树上有n个点,然后每个点都有一盏灯,给出初始的状态,1表示亮,0表示不亮,然后有两种操作,第一种是get x,表示你需要输出x的子树和x本身 ...

  7. [BZOJ4358]Permu(回滚莫队)

    [BZOJ4358]Permu(回滚莫队) 题面 给出一个长度为n的排列P(P1,P2,...Pn),以及m个询问.每次询问某个区间[l,r]中,最长的值域连续段长度. 分析 最简单的方法显然是用线段 ...

  8. 一个完整的http请求响应过程

    一. HTTP请求和响应步骤   图片来自:理解Http请求与响应 以上完整表示了HTTP请求和响应的7个步骤,下面从TCP/IP协议模型的角度来理解HTTP请求和响应如何传递的. 二.TCP/IP协 ...

  9. P2876 [USACO07JAN]解决问题Problem Solving

    传送门 显然的 $dp$,设 $f[i][j]$ 表示做完第 $i$ 题,此月做的题的区间为 $[j,i]$ 需要的最少月数 每个月记得分成还钱并写新题,和只还钱分类讨论,不要搞成每个月强制做一题 那 ...

  10. ASP.NET @URL帮助类

    原文: https://www.cnblogs.com/bobo-show/p/5746389.html    https://www.cnblogs.com/zhuji/p/7698057.html ...