PythonPandas:'努比·恩达雷'对象没有属性'apply'

2024-10-01 15:40:39 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个数据帧,我从中选择了唯一的值,它产生了一个形状(1187,)的ndarray(“unManager”)。。。只有一列。在

现在,我已经编写了一个函数来对数据帧的一些行进行分组、进行计算并在ndarray中添加值。在

为此,我在ndarray(“unManager”)上使用apply,并得到以下错误:

AttributeError                            Traceback (most recent call last)
<ipython-input-48-ff7e78ab33a7> in <module>()
----> 1 unManager.apply(runThis, axis=0)

AttributeError: 'numpy.ndarray' object has no attribute 'apply'

现在,当我试图将ndarray(“unManager”)转换为数据帧时,通过:

^{pr2}$

我得到以下错误:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-55-3ee3d2605321> in <module>()
----> 1 dfs = pd.DataFrame(unManager,index=unManager[0])
.
.
TypeError: Index(...) must be called with a collection of some kind, 'actama99,CLE' was passed

“actama99,CLE”这里是shape(1187,)的ndarray(“unManager”)的第一个值。在

有人能告诉我我做错了什么吗?TIA公司


Tags: 数据inmostinput错误ipythoncalllast

热门问题