Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

How to Fix: TypeError: ‘numpy.float’ object is not callable?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

In this article, we are going to see how to fix TypeError: ‘numpy.float’ object is not callable in Python. There is only one case in which we can see this error: 

If we try to call a NumPy array as a function, we are most likely to get such an error. 

Example:

Python3




import numpy as np
  
a = np.array([1,2,3])
  
a()

Output:

TypeError: 'numpy.ndarray' object is not callable

In the older version of Numpy, we used to see “numpy.float64” instead of “numpy.ndarray”.

Solution: 

This can be solved simply by removing the parenthesis after the array. 

Python3




import numpy as np
  
a = np.array([1,2,3])
  
a

Output:

array([1, 2, 3])

Here version of NumPy is ‘1.21.2’.

Note: In the earlier version of Numpy, we also used to get this error while using Python min() or max() function with a NumPy array. In the recent versions of NumPy, this is solved.  In the earlier versions, this particular error was supposed to be solved using np.max() or np.min() instead of min() and max(). 

My Personal Notes arrow_drop_up
Last Updated : 28 Nov, 2021
Like Article
Save Article
Similar Reads
Related Tutorials