numpy.MaskedArray.resize() function is used to a make a new masked array with the specified size and shape from the given array.The new array is filled with repeated copies of arr (in the order that the data are stored in memory). If arr is masked, the new array will be masked, and the new mask will be a repetition of the old one.
arr: The input array which to be resized.
new_shape:[ int or tuple of ints] The new shape of resized array.
Return : [ resized_array] A new shape of the array.
Code #1 :
Input array : [[ 10 20] [-10 40]] Masked array : [[-- 20] [-10 40]] Output resized masked array : [[-- 20 -10] [40 -- 20] [-10 40 --]]
Code #2 :
Input array : [[[ 2.e+08 3.e-05]] [[-4.e-06 2.e+05]]] Masked array : [[[-- 3e-05]] [[-4e-06 200000.0]]] Output resized masked array : [[-- 3e-05 -4e-06 200000.0 -- 3e-05]] ?
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.