gpt4 book ai didi

pandas - 模块 'pandas' 没有属性 'Panel'

转载 作者:行者123 更新时间:2023-12-04 12:16:01 24 4
gpt4 key购买 nike

将字典数据框转换为面板数据框时出现错误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:\miniconda\lib\site-packages\pandas\__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'

最佳答案

我自己找到了答案,我使用的是最新的 Pandas v1.2.0,该面板已从 Pandas 模块 0.25.0 中删除。

print(pd.__version__)
print(np.__version__)
1.2.0
1.19.4
来自 0.25.0/ 1.2.0发行说明
Warning: The panel has been fully removed. For N-D labeled data structures, please use xarray
除非你想使用 xarray ,您需要在此之前卸载并安装该版本。

关于pandas - 模块 'pandas' 没有属性 'Panel',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65600306/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com