C:\Users\HP\PycharmProjects\pythonProject\Python 试验.py:2: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support skipfooter; you can avoid this warning by specifying engine='python'. df = pd.read_csv('D:\\A过铁精矿\\ related.txt', header=None, skiprows=1, skipfooter=1, delimiter='\t') Traceback (most recent call last): File "C:\Users\HP\PycharmProjects\pythonProject\Python 试验.py", line 2, in <module> df = pd.read_csv('D:\\A过铁精矿\\ related.txt', header=None, skiprows=1, skipfooter=1, delimiter='\t') File "D:\ProgramData\anaconda3\lib\site-packages\pandas\util\_decorators.py", line 211, in wrapper return func(*args, **kwargs) File "D:\ProgramData\anaconda3\lib\site-packages\pandas\util\_decorators.py", line 331, in wrapper return func(*args, **kwargs) File "D:\ProgramData\anaconda3\lib\site-packages\pandas\io\parsers\readers.py", line 950, in read_csv return _read(filepath_or_buffer, kwds) File "D:\ProgramData\anaconda3\lib\site-packages\pandas\io\parsers\readers.py", line 605, in _read parser = TextFileReader(filepath_or_buffer, **kwds) File "D:\ProgramData\anaconda3\lib\site-packages\pandas\io\parsers\readers.py", line 1442, in __init__ self._engine = self._make_engine(f, self.engine) File "D:\ProgramData\anaconda3\lib\site-packages\pandas\io\parsers\readers.py", line 1735, in _make_engine self.handles = get_handle( File "D:\ProgramData\anaconda3\lib\site-packages\pandas\io\common.py", line 856, in get_handle handle = open( FileNotFoundError: [Errno 2] No such file or directory: 'D:\\A过铁精矿\\ related.txt'
时间: 2023-06-30 15:16:20 浏览: 179
1238: UserWarning: findfont: Font family [‘sans-serif’] not found. Falling back to DejaVu Sans.
这个错误提示中显示,程序无法找到指定的文件 "D:\\A过铁精矿\\ related.txt"。很可能是文件名或路径有误。请检查一下文件名和路径是否正确,或者尝试使用绝对路径来确保程序能够正确地找到文件。此外,你使用了 skipfooter 参数,但是在使用 'c' 引擎的情况下,它不被支持,因此建议使用 'python' 引擎或者不使用 skipfooter 参数。
你可以尝试使用以下代码:
```
import pandas as pd
file_path = 'D:\\A过铁精矿\\ related.txt'
df = pd.read_csv(file_path, header=None, skiprows=1, delimiter='\t', engine='python')
```
希望这能帮到你。
阅读全文