问题描述
我目前正在学习Pandas进行数据分析,并且在Atom编辑器中读取csv文件时遇到一些问题.
I am currently learning Pandas for data analysis and having some issues reading a csv file in Atom editor.
当我运行以下代码时:
import pandas as pd
df = pd.read_csv("FBI-CRIME11.csv")
print(df.head())
我收到一条错误消息,结尾为
I get an error message, which ends with
这是文件的目录:/Users/alekseinabatov/Documents/Python/"FBI-CRIME11.csv.
Here is the directory to the file: /Users/alekseinabatov/Documents/Python/"FBI-CRIME11.csv".
当我尝试以这种方式运行它时:
When i try to run it this way:
df = pd.read_csv(Users/alekseinabatov/Documents/Python/"FBI-CRIME11.csv")
我遇到另一个错误:
我也已将该目录放入编辑器设置中的"Project Home"字段中,尽管我不确定它是否有任何作用.
I have also put this directory into the "Project Home" field in the editor settings, though I am not quite sure if it makes any difference.
我敢打赌,有一种简单的方法可以使其正常工作.我将衷心感谢您的帮助!
I bet there is an easy way to get it to work. I would really appreciate your help!
推荐答案
您尝试过吗?
df = pd.read_csv("Users/alekseinabatov/Documents/Python/FBI-CRIME11.csv")
或者也许
df = pd.read_csv('Users/alekseinabatov/Documents/Python/"FBI-CRIME11.csv"')
(如果文件名带有引号)
(If the file name has quotes)
这篇关于"CSV文件不存在"带有嵌入式引号的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!