python – TypeError: numpy.float64 object is not callable
Table of Contents
python – TypeError: numpy.float64 object is not callable
Python does not follow the same rules as written math. You must explicitly indicate multiplication.
Bad:
(a)(b)
(unless a
is a function)
Good:
(a) * (b)
This error also occurs when your function has the same name as your return value
def samename(a, b):
samename = a*b
return samename
This might be a super rookie mistake, I am curious how often this answer will be helpful.
python – TypeError: numpy.float64 object is not callable
You are missing *
when multiplying, try:
import numpy as np
yy = np.arange(4)
xx = np.arange(5)
Area = ((xx[2] - xx[1])*(yy[2] + yy[1])) / 2
Related posts on Python :
- python – Seaborn Lineplot Module Object Has No Attribute Lineplot
- AttributeError: NoneType object has no attribute lower python
- python – ModuleNotFoundError: No module named discord
- pandas – Python: Convert timedelta to int in a dataframe
- Airflow – How to pass xcom variable into Python function
- python – TypeError: expected a character buffer object
- python – Token error: EOF in multi-line statement
- python – Strip / trim all strings of a dataframe
- Python: Queue.Empty Exception Handling