import numpy as np


a = np.array([[50,10,30],
              [60,20,40],
              [70,80,90]])
# return simple average of all element from an array
print()
print(np.average(a))


# For calculating weighted average of all column element from an array
# multiplying each value from each column by its weight,
# then you add up the products and divide this products sum
# by the sum of all weights.

w=[1,2,3]

print()
print(np.average(a,weights=w,axis=0))

# For calculating weighted average of all row element from an array
# multiplying each value from each row by its weight,
# then you add up the products and divide this products sum
# by the sum of all weights.


print()
print(np.average(a,weights=w,axis=1))
print()
