I want to find the standard deviation of the arrangement at once.

Asked 2 years ago, Updated 2 years ago, 106 views

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.

python numpy array

2022-09-30 16:03

1 Answers

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])


2022-09-30 16:03

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.