Course
machine-learning-zoomcamp
Question
Why am I getting TypeError: 'list' object is not callable when creating a NumPy array?
Answer
This usually happens when np.array was accidentally overwritten by a list in an earlier Jupyter cell. Since the Jupyter kernel retains previous variable assignments, simply editing or deleting the problematic cell may not fix it.
The quickest solution is to restart the Jupyter kernel (Kernel → Restart), then run:
import numpy as np
y = np.array([1100, 1300, 800, 900, 1000, 1100, 1200])
After restarting, np.array() will point back to NumPy's original function.
Checklist
Course
machine-learning-zoomcamp
Question
Why am I getting TypeError: 'list' object is not callable when creating a NumPy array?
Answer
This usually happens when np.array was accidentally overwritten by a list in an earlier Jupyter cell. Since the Jupyter kernel retains previous variable assignments, simply editing or deleting the problematic cell may not fix it.
The quickest solution is to restart the Jupyter kernel (Kernel → Restart), then run:
After restarting,
np.array()will point back to NumPy's original function.Checklist