[英]Converting numpy array into pandas dataframe
I am getting error while converting the numpy array to pandas dataframe. 将numpy数组转换为pandas数据框时出现错误。 suppose I am adding the following arrays
a
and b
using np.vstack
假设我正在使用
np.vstack
添加以下数组a
和b
a=np.array((1,2,3,4))
b=np.array((11,22,33,44))
c=np.vstack((a,b))
pd.DataFrame(c)
The last command give the following error: 最后一条命令给出以下错误:
TypeError: 'numpy.ndarray' object is not callable
Where could be the mistake here? 这里的错误可能在哪里?
pd.DataFrame(data=c)
Thats an easy fix 那很容易解决
>>> a=numpy.array((1,2,3,4))
>>> b=numpy.array((11,22,33,44))
>>> c=numpy.vstack((a,b))
>>> pd.DataFrame(data=c)
0 1 2 3
0 1 2 3 4
1 11 22 33 44
Do you have any other code than this you shared here? 除了在这里共享的代码以外,您还有其他代码吗? "TypeError: 'numpy.ndarray' object is not callable" means you have a variable of type 'numpy.ndarray' that tries to call something.
“ TypeError:'numpy.ndarray'对象不可调用”意味着您有一个类型为'numpy.ndarray'的变量试图调用某些内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.