python-3.x - FileNotFoundError Traceback(最近一次调用最后一次)
问题描述
帮我解决这个问题,以导入 csv 文件 ''' ------------------------------------ --------------------------------------- FileNotFoundError Traceback(最近一次调用最后一次)在 -- --> 1 df=pd.read_csv('voci_retributive',index_col='Order Date',parse_dates=True,encoding='ansi', sep=';') #这里我使用的是编码属性
/opt/anaconda3/lib/python3.8/site-packages/pandas/io/parsers.py in read_csv(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, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, dialect, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision)
684 )
685
--> 686 return _read(filepath_or_buffer, kwds)
687
688
/opt/anaconda3/lib/python3.8/site-packages/pandas/io/parsers.py in _read(filepath_or_buffer, kwds)
450
451 # Create the parser.
--> 452 parser = TextFileReader(fp_or_buf, **kwds)
453
454 if chunksize or iterator:
/opt/anaconda3/lib/python3.8/site-packages/pandas/io/parsers.py in __init__(self, f, engine, **kwds)
944 self.options["has_index_names"] = kwds["has_index_names"]
945
--> 946 self._make_engine(self.engine)
947
948 def close(self):
/opt/anaconda3/lib/python3.8/site-packages/pandas/io/parsers.py in _make_engine(self, engine)
1176 def _make_engine(self, engine="c"):
1177 if engine == "c":
-> 1178 self._engine = CParserWrapper(self.f, **self.options)
1179 else:
1180 if engine == "python":
/opt/anaconda3/lib/python3.8/site-packages/pandas/io/parsers.py in __init__(self, src, **kwds)
1989 if kwds.get("compression") is None and encoding:
1990 if isinstance(src, str):
-> 1991 src = open(src, "rb")
1992 self.handles.append(src)
1993
'''
解决方案
尝试将文件名参数从“voci_retributive”更改为“voci_retributive.csv”或它具有的任何扩展名
推荐阅读
- ios - iOS 动画在 iOS 11.0 及更高版本上完美运行,但在低于 11.0 的 iOS 版本上出现问题
- express - 如何在 Express.js 中访问 post 请求的原始正文?
- node.js - 我是猫鼬的新手。我想通过添加作为另一个模式的值的字段来修改现有模式?
- aws-sam-cli - 如何使用 python 在本地安装 AWS SAM?
- asterisk - Asterisk 服务无法运行
- php - 如何从 stdClass 字符串中提取值?
- php - 无法在 Laravel 控制器中使用“Helori\LaravelSeo\SeoServiceProvider\Seo”
- angular - Angular 5 - 动态添加样式到特定元素
- ios - 为 iOS 应用程序实现侧边菜单,应用程序在显示手势时崩溃。
- java - Ant SVN 部分构建