我有一个Python 3.6 | Anaconda 4.3.1(64位)|安装。当我在命令窗口或IPython中以shell模式导入pandas时,它工作正常。
我试图运行的代码非常简单
Traceback (most recent call last):
File "series_intro.py", line 1, in <module> import pandas as pd
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", line 37,
in <module>
import pandas.core.config_init
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\config_init.py",
line 18, in <module>
from pandas.formats.format import detect_console_encoding
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\formats\format.py", li
ne 33, in <module>
from pandas.io.common import _get_handle, UnicodeWriter, _expand_user
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\common.py", line 40
7, in <module>
def UnicodeReader(f, dialect=csv.excel, encoding="utf-8", **kwds):
AttributeError: module 'csv' has no attribute 'excel'
但是,当我使用notepad ++编写代码并从命令窗口调用它时(例如,python text.py),它会引发以下异常:
import csv
print(csv.__file__)
import pandas as pd
animals = ['Tiger', 'Bear', 'Moose']
print(pd.Series(animals))
请帮忙。
尝试了此线程上的响应建议并将代码修改为
C:\Users\k\Dropbox\data science>python panda_intro.py
C:\Users\k\Dropbox\data science\csv.py
Traceback (most recent call last):
File "panda_intro.py", line 3, in <module>
import pandas as pd
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", line 37,
in <module>
import pandas.core.config_init
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\config_init.py",
line 18, in <module>
from pandas.formats.format import detect_console_encoding
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\formats\format.py", li
ne 33, in <module>
from pandas.io.common import _get_handle, UnicodeWriter, _expand_user
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\common.py", line 40
7, in <module>
def UnicodeReader(f, dialect=csv.excel, encoding="utf-8", **kwds):
AttributeError: module 'csv' has no attribute 'excel'
发生以下追溯错误:
application.yml