Skip to content

NumPy Problems

Awantik Das edited this page Sep 15, 2018 · 1 revision
  • Create a null array of size 10 but the fifth value which is 1
  • Reverse a above created array (first element becomes last)
  • Create a 3x3 matrix with values ranging from 0 to 8
  • Find indices of non-zero elements from [1,2,0,0,4,0]
  • Create a 3x3x3 array with random values
  • Create a 10x10 array with random values and find the minimum and maximum values
  • Create a random vector of size 30 and find the mean value
  • Create a 2d array with 1 on the border and 0 inside
  • Consider a (6,7,8) shape array, what is the index (x,y,z) of the 100th element
  • Multiply a 5x3 matrix by a 3x2 matrix (real matrix product)
  • Extract the integer part of a random array
  • Create a 5x5 matrix with row values ranging from 0 to 4
  • Create a random vector of size 10 and sort it
  • Consider two random array A anb B, check if they are equal
  • How to tell if a given 2D array has null columns?
  • Considering a four dimensions array, how to get sum over the last two axis at once?
  • Consider an array of dimension (5,5,3), how to mulitply it by an array with dimensions (5,5)?
  • Extract all the contiguous 3x3 blocks from a random 10x10 matrix
  • How to compute averages using a sliding window over an array?
  • Consider a 16x16 array, how to get the block-sum (block size is 4x4)?
Clone this wiki locally