We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Numpy
- Mean, Var, and Std
- Discussions
Mean, Var, and Std
Mean, Var, and Std
Sort by
recency
|
438 Discussions
|
Please Login in order to post a comment
import numpy N, M = map(int, input().strip().split()) my_arr = numpy.array([input().strip().split()[:M] for _ in range(N)], dtype=numpy.float_) print(numpy.mean(my_arr, axis=1)) print(numpy.var(my_arr, axis=0)) print(round(numpy.std(my_arr, axis = None), 11))
import numpy
n , m = map(int,input().split())
arrayList = [] for i in range(n): arrayList.append(list(map(int,input().split())))
my_array = numpy.array(arrayList) print(numpy.mean(my_array, axis = 1)) print(numpy.var(my_array, axis = 0)) print(round(numpy.std(my_array, axis = None), 11))
import numpy as np
n, m = map(int, input().split())
array = np.array([list(map(int,input().split())) for _ in range(n)])
mean = np.mean(array,axis=1)
var = np.var(array, axis=0)
std = np.std(array)
print(mean) print(var) print(f"{std:.11f}")
import numpy as np
n,m = map(int, input().split()) a= [] for i in range(n): a.append(list(map(int, input().split()))) print(np.mean(a, axis = 1)) print(np.var(a, axis = 0)) print(round(np.std(a),11))
n, m = list(map(int, input().strip().split()))
arr = np.array([list(map(int,(input().strip().split()))) for _ in range(n)])
print(np.mean(arr, axis=1)) print(np.var(arr, axis=0)) print(round(np.std(arr), 11))