1

I am getting error while converting the numpy array to pandas dataframe. suppose I am adding the following arrays a and b using np.vstack

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?

Istvan
  • 7,500
  • 9
  • 59
  • 109
lsr729
  • 752
  • 2
  • 11
  • 25

2 Answers2

1
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
vi_me
  • 373
  • 4
  • 17
0

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.

Petronella
  • 2,327
  • 1
  • 15
  • 24