Exercises with Numpy arrays¶
Try me¶
Use array programming to calculate the total sales revenues given the vector of sold units:
python sold_units = [15, 13, 23]and a the vector of prices per unitpython prices = [10, 8, 9]. Both vectors contain the sales and prices of the products in the same ordering by product type.
Reshape the following array
an_array = [0,1,2,3,4,5,6,7]into a matrix of rank 3 and equal number of elements in each dimension
Check the Numpy library documentation and write a Python script to generate a multidimensional array of shape (10,10,1000) where the elements are integer numbers drawn from a discrete uniform distribution in the range [0, 100].
Write a script to compute the average values of the matrix above along each dimension, using the function numpy.mean.
Write a Python script that a) defines two arrays of shape (1000,1000) and b) defines a third array that contains the element-wise maxima of the elements in both arrays. Check the numpy.maximum documentation.