I have a numpy
array
like this example:
example:
arr = array([[31, 18],
[ 27, 9],
[21, 20]])
and I want to get the mean
of every inner list separately and also
standard deviation
of every inner list separately. until here I would
have 2 lists (for mean and std) and every list would have 3 items (one
per inner list in arr).
then I will multiply every single item of std list and then will add
mean list and new std list item by item. so at the end the results
would be a list with 3 items.
here is the steps for the example:
std = [9.19238815542512, 12.7279220613579, 0.707106781186548]
std2 = [18.3847763108502, 25.4558441227157, 1.4142135623731]
mean = [24.5, 18, 20.5]
and here is the expected output:
final = [42.8847763108502, 43.4558441227157, 21.9142135623731]
to make such results I wrote the following code in python:
import numpy as np
for item in arr:
mean, std = [np.mean(), np.std()*2]
results = mean + std
but it does not return expected output. do you know how to fix it?