I use python and numpy to calculate the standard deviation into an array, but since I use for, it is very slow and troublesome.
I would appreciate it if there was a way to find the standard deviation of the array at once, but if anyone has a good way, please advise me.
There is a function called numpy.std
, which determines the standard deviation.
By the way, it seems that ddof=1
should be used to determine the unbiased standard deviation.
Addition (October 4, 2017 22:19)
Specify axis
to calculate the standard deviation along that axis.So if you want to calculate the standard deviation of each array for an array of arrays, you can specify axis=1
.
>>a=np.array([31,19,1], [2,1,1]])
>>>np.std(a,axis=1)
array (12.32882801, 0.47140452])
© 2025 OneMinuteCode. All rights reserved.