Python 读取数据故障排除

Python 读取数据故障排除,python,pandas,dataframe,Python,Pandas,Dataframe,我读取数据有困难。我正在使用Mac,在我的桌面上用以下名称保存了文件,可以在jupyter文件夹中看到它们,但在尝试使用以下代码时无法打开它们。有人能提供建议吗 df_students = pd.read_excel(students.xlsx) df_students 错误: --------------------------------------------------------------------------- AttributeError

我读取数据有困难。我正在使用Mac,在我的桌面上用以下名称保存了文件,可以在jupyter文件夹中看到它们,但在尝试使用以下代码时无法打开它们。有人能提供建议吗

df_students = pd.read_excel(students.xlsx)
df_students
错误:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-44-14c48be800d6> in <module>
----> 1 df_students = pd.read_excel(students.xlsx)
      2 df_students

AttributeError: 'dict' object has no attribute 'xlsx'
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-45-fe5b1bb04ec7> in <module>
----> 1 df_census = pd.read_csv(census.csv)
      2 df_census

NameError: name 'census' is not defined
错误:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-44-14c48be800d6> in <module>
----> 1 df_students = pd.read_excel(students.xlsx)
      2 df_students

AttributeError: 'dict' object has no attribute 'xlsx'
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-45-fe5b1bb04ec7> in <module>
----> 1 df_census = pd.read_csv(census.csv)
      2 df_census

NameError: name 'census' is not defined
---------------------------------------------------------------------------
NameError回溯(最近一次呼叫上次)
在里面
---->1 df_census=pd.read_csv(census.csv)
2 DFU普查
NameError:未定义名称“普查”

您应该以字符串形式传递文件名,即在诸如
df_students=pd.read_excel('students.xlsx')之类的引号中传递文件名。
阅读函数。请阅读更多关于pd.read_csv的内容。这是否回答了您的问题?