导入 Pandas 会出现错误 AttributeError: module 'pandas' has no attribute 'core' in iPython Notebook
问题描述
我正在通过 Anaconda Navigator 应用程序(版本 1.1.0)运行 iPython 笔记本.当我想导入熊猫时,它给了我一个奇怪的错误.我以为 Anaconda 应用包含 pandas 包?
I am running a iPython notebook via the Anaconda Navigator app (version 1.1.0). When I want to import pandas it gives me a strange error. I thought the Anaconda app included the pandas package?
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-4-af55e7023913> in <module>()
----> 1 import pandas as pd
/Users/bertcarremans/anaconda/lib/python3.5/site-packages/pandas/__init__.py in <module>()
37 import pandas.core.config_init
38
---> 39 from pandas.core.api import *
40 from pandas.sparse.api import *
41 from pandas.stats.api import *
/Users/bertcarremans/anaconda/lib/python3.5/site-packages/pandas/core/api.py in <module>()
8 from pandas.core.common import isnull, notnull
9 from pandas.core.categorical import Categorical
---> 10 from pandas.core.groupby import Grouper
11 from pandas.core.format import set_eng_float_format
12 from pandas.core.index import (Index, CategoricalIndex, Int64Index,
/Users/bertcarremans/anaconda/lib/python3.5/site-packages/pandas/core/groupby.py in <module>()
16 DataError, SpecificationError)
17 from pandas.core.categorical import Categorical
---> 18 from pandas.core.frame import DataFrame
19 from pandas.core.generic import NDFrame
20 from pandas.core.index import (Index, MultiIndex, CategoricalIndex,
/Users/bertcarremans/anaconda/lib/python3.5/site-packages/pandas/core/frame.py in <module>()
37 create_block_manager_from_arrays,
38 create_block_manager_from_blocks)
---> 39 from pandas.core.series import Series
40 from pandas.core.categorical import Categorical
41 import pandas.computation.expressions as expressions
/Users/bertcarremans/anaconda/lib/python3.5/site-packages/pandas/core/series.py in <module>()
33 from pandas.core.internals import SingleBlockManager
34 from pandas.core.categorical import Categorical, CategoricalAccessor
---> 35 import pandas.core.strings as strings
36 from pandas.tseries.common import (maybe_to_datetimelike,
37 CombinedDatetimelikeProperties)
AttributeError: module 'pandas' has no attribute 'core'
解决方案
显然我在尝试导入 pandas 第一次时遇到的错误是 ValueError: unknown locale: UTF-8
Apparently the error I got when trying to import pandas for the first time was ValueError: unknown locale: UTF-8
之后尝试再次导入,出现了另一个错误,如我上面的问题所述.
Trying to import again afterwards, gave another error as described in my question above.
我在 IPython Notebook 语言环境错误
更新我的 bash 配置文件后,错误 AttributeError: module 'pandas' has no attribute 'core'
不再出现.
After updating my bash profile, the error AttributeError: module 'pandas' has no attribute 'core'
did not appear anymore.
相关文章