pandas 文件 b'.csv' 不存在
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52908546/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
File b'.csv' does not exist
提问by tavif bicandra
import pandas as pd
df = pd.read_csv("stei-c-1.csv")
when the code is running :
当代码运行时:
FileNotFoundError: File b'stei-c-1.csv' does not exist
FileNotFoundError:文件 b'stei-c-1.csv' 不存在
here the directory of file D:\ITB\Tugas\PTI\H4
这里是文件 D:\ITB\Tugas\PTI\H4 的目录
the python file and the csv file in same location. how to fix it, thanks !
python 文件和 csv 文件在同一位置。怎么修,谢谢!
回答by Karn Kumar
It should simply work by giving complete path.
它应该简单地通过提供完整的路径来工作。
df = pd.read_csv(r"D:\ITB\Tugas\PTI\H4\stei-c-1.csv")
However, as other mentioned if you are standing on the same Directory path where your Files are then you don't really need to mention the Full Path otherwise best to place absolute Path.
但是,正如其他人提到的,如果您站在文件所在的同一目录路径上,那么您实际上不需要提及完整路径,否则最好放置绝对路径。