Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

module 'pandas' has no attribute 'Panel'

I am getting an error while I am converting dictionary data frames to Panel dataframe

panelda = pd.Panel()

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-33-e8e84d2172b7> in <module>
     11     panaldata[ticker] = panaldata[ticker][["Open","High","Low","Close","Volume"]]
     12     #print(panaldata[ticker].head())
---> 13 panelda = pd.Panel()
     14 #panelda.minor_axis = ["Open","High","Low","Close","Volume"]
     15 #panelda.major_axis = panel.major_axis.tz_localize(pytz.ist)

c:minicondalibsite-packagespandas\__init__.py in __getattr__(name)
    242         return _SparseArray
    243 
--> 244     raise AttributeError(f"module 'pandas' has no attribute '{name}'")
    245 
    246 

AttributeError: module 'pandas' has no attribute 'Panel'

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Found the answer myself, I was using the latest Pandas v1.2.0, where the panel has been removed from Pandas module 0.25.0 onwards.

print(pd.__version__)
print(np.__version__)
1.2.0
1.19.4

From 0.25.0 / 1.2.0 release notes

Warning: The panel has been fully removed. For N-D labeled data structures, please use xarray

unless you want to use xarray, you need to uninstall and install the version prior to that.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...