zoukankan      html  css  js  c++  java
  • (转)pd.read_csv之OSError: Initializing from file failed的解决方案

    转: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:usersadministratorappdatalocalprogramspythonpython36libsite-packagespandasioparsers.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:usersadministratorappdatalocalprogramspythonpython36libsite-packagespandasioparsers.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:usersadministratorappdatalocalprogramspythonpython36libsite-packagespandasioparsers.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:usersadministratorappdatalocalprogramspythonpython36libsite-packagespandasioparsers.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:usersadministratorappdatalocalprogramspythonpython36libsite-packagespandasioparsers.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\_libsparsers.pyx in pandas._libs.parsers.TextReader.__cinit__()
    pandas\_libsparsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()
    OSError: Initializing from file failed1234567891011121314151617181920212223242526272829303132333435363738394041424344
     
    解决方案:
    1.把当前路径中的中文改成英文。
    2.cd到你的csv文件目录下,然后直接打开csv文件。
  • 相关阅读:
    To select the file to upload we can use the standard HTML input control of type
    Cascading Menu Script using Javascript Explained
    网站首页head区代码规范
    轻松掌握 Java 泛型
    JDK 5.0 中的泛型类型学习
    如何在firefox下获取下列框选中option的text
    是同步方法还是 synchronized 代码? 详解多线程同步规则
    javascript select option对象总结
    Select的动态取值(Text,value),添加,删除。兼容IE,FireFox
    javascript在ie和firefox下的一些差异
  • 原文地址:https://www.cnblogs.com/wangle1001986/p/9785936.html
Copyright © 2011-2022 走看看