How to get the standard deviation of a NumPy array using the np.std function in the Python programming language. More details: [ Ссылка ]
Python code of this video:
import numpy as np # Import NumPy library in Python
my_array = np.array([[1, 2, 7, 2, 3], # Create example array
[7, 1, 1, 5, 6],
[5, 2, 5, 5, 8]])
print(my_array) # Print example array
# [[1 2 7 2 3]
# [7 1 1 5 6]
# [5 2 5 5 8]]
print(np.std(my_array)) # Get standard deviation of all array values
# 2.3380903889000244
print(np.std(my_array, ddof = 1)) # Get standard deviation of all array values
# 2.4201534780139164
print(np.std(my_array, axis = 0)) # Get standard deviation of array columns
# [2.49443826 0.47140452 2.49443826 1.41421356 2.05480467]
print(np.std(my_array, axis = 1)) # Get standard deviation of array rows
# [2.0976177 2.52982213 1.8973666 ]
Follow me on Social Media:
Facebook – Statistics Globe Page: [ Ссылка ]
Facebook – Group for Discussions & Questions: [ Ссылка ]
LinkedIn – Statistics Globe Page: [ Ссылка ]
LinkedIn – Group for Discussions & Questions: [ Ссылка ]
Twitter: [ Ссылка ]
Music by bensound.com
Ещё видео!