Jan-17-2021, 01:48 PM
(Jan-17-2021, 03:00 AM)deanhystad Wrote:Thanks deanhystad!Quote:numpy.array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0)You can do np.array([1, 2, 3, 4, 5]) but you cannot do np.array(1, 2, 3, 4, 5)
Parameters
object : array_like
An array, any object exposing the array interface, an object whose __array__ method returns an array, or any (nested) sequence.
You can use a list comprehension to replace all those error prone subtractions.
I do indeed have a lot more to learn. The list comprehension you wrote is something I definitely have to get more knowledge about.
The array initially was created like np.array([1, 2, 3, 4, 5]). I got quite a few errors when it was coded like that. Tried many different things to correct the errors, and never changed it back. I guess that is where the list comprehension would solve that. You have given me an example on how to improve upon what I was doing wrong, and also what to investigate on learning what to do in the future. For that, I thank you!