熊猫read_csv()给我错误:OSError:从文件初始化失败

时间:2019-04-01 18:00:50

标签: python pandas

我正在尝试调用该文件夹中的所有文件,而我朋友编写的代码在他的计算机上也可以正常工作,但是它不断给我带来错误,并且我找不到解决方法

num_samples_w_nan = np.zeros((40,1))
for file in data_files:
    #print(file)
    data = pd.read_csv(file,delimiter="|")

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-15-5e6ff743ed35> in <module>()
      3 for file in data_files:
      4     #print(file)
----> 5     data = pd.read_csv(file,delimiter="|")
      6 #    for feat_ix in range(data.shape[1]):
      7 #        if data.iloc[:,feat_ix].isnull().all():

C:\Users\Yeseul Kim\Anaconda3\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, skipfooter, 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, skip_footer, doublequote, delim_whitespace, as_recarray, compact_ints, use_unsigned, low_memory, buffer_lines, memory_map, float_precision)

0 个答案:

没有答案