Python Forum
'numpy.ndarray' object is not callable
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'numpy.ndarray' object is not callable
#1
distances = np.zeros(points.shape[0])

for i in range(len(distances)):
    distances[i] = distances(p, points[i])
        
Error:
TypeError Traceback (most recent call last) <ipython-input-45-a46653deacff> in <module> 4 #we're going to loop all over the points we have 5 for i in range(len(distances)): ----> 6 distances[i] = distances(p, points[i]) 7 8 TypeError: 'numpy.ndarray' object is not callable
I just wanted to know how to resolve this. Thank you
Reply
#2
The error TypeError: 'numpy.ndarray' object is not callable means that you tried to call a numpy array as a function.

distances[i] = distances[p, points[i]]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Numpy] How to store different data type in one numpy array? water 7 540 Mar-26-2024, 02:18 PM
Last Post: snippsat
  Numpy returns "TypeError: unsupported operand type(s) for *: 'numpy.ufunc' and 'int'" kalle 2 2,602 Jul-19-2022, 06:31 AM
Last Post: paul18fr
  numpy.ndarray' object is not callable natareid 4 3,833 Oct-16-2020, 08:00 AM
Last Post: sanrock123
  numpy.float64 object is not iterable jcdr91 1 13,222 Apr-22-2020, 04:09 PM
Last Post: jefsummers
  What is the mechanism of numpy function returning pandas object? Ibaraki 2 2,496 Apr-04-2020, 10:57 PM
Last Post: Ibaraki
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 2,976 Apr-09-2019, 04:54 PM
Last Post: PhysChem

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020