How to apply the np.var function in the Python programming language. More details: [ Ссылка ]
Python code of this video:
import numpy as np # Import NumPy library
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.var(my_array)) # Get variance of all array values
# 5.466666666666667
print(np.var(my_array, axis = 0)) # Get variance of array columns
# [6.22222222 0.22222222 6.22222222 2. 4.22222222]
print(np.var(my_array, axis = 1)) # Get variance of array rows
# [4.4 6.4 3.6]
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
Ещё видео!