I have an array that looks like this:
sample_array = [(1,3),(2,2),(3,1)]
I need to find the average to output :
>> [2,2]
I tried the code below
np.average(left_lane)
but it returns
>> 2.0
How can I make it so that it returns two values without having to loop?
You can use:
a = np.array(sample_array)
np.average(a, axis=0)
Or:
a.mean(0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With