贯彻发展新理念 发表于 2021-3-25 11:21:05

求助!pandas库read_csv报错无法解决

刚开始学习pandas库的使用,结果第一步就卡住了,在CSDN上也没有找到解决办法,求大佬们指点{:5_107:}
import pandas as pd
df = pd.read_csv('Stu_Info\Stu_Info.csv')
print(df)

然后就出现了以下的报错:
Traceback (most recent call last):
File "E:/FYP/Week 4/copy.py", line 1, in <module>
    import pandas as pd
File "D:\Python37\lib\site-packages\pandas\__init__.py", line 54, in <module>
    from pandas.core.api import (
File "D:\Python37\lib\site-packages\pandas\core\api.py", line 29, in <module>
    from pandas.core.groupby import Grouper, NamedAgg
File "D:\Python37\lib\site-packages\pandas\core\groupby\__init__.py", line 1, in <module>
    from pandas.core.groupby.generic import DataFrameGroupBy, NamedAgg, SeriesGroupBy
File "D:\Python37\lib\site-packages\pandas\core\groupby\generic.py", line 9, in <module>
    import copy
File "E:\FYP\Week 4\copy.py", line 3, in <module>
    df = pd.read_csv('Stu_Info\Stu_Info.csv')
AttributeError: module 'pandas' has no attribute 'read_csv'

hrp 发表于 2021-3-25 11:26:58

你的源代码不要命名为copy.py,跟内置库重名了。
页: [1]
查看完整版本: 求助!pandas库read_csv报错无法解决