def _resize(masked, new_size):
 new_array = ma.zeros((new_size,), dtype=masked.dtype)
 length = min(len(masked), new_size)
 try:
  new_array.data[:length] = masked.data[:length]
 except TypeError:
  new_array[:length] = masked[:length]
 else:
  if (length != 0):
   new_array.mask[:length] = masked.mask[:length]
 return new_array

def _resize ( masked , new_size ) : new_array = ma . zeros ( ( new_size , ) , dtype = masked . dtype ) length = min ( len ( masked ) , new_size ) try : new_array . data [ : length ] = masked . data [ : length ] except TypeError : new_array [ : length ] = masked [ : length ] else : if ( length != 0 ) : new_array . mask [ : length ] = masked . mask [ : length ] return new_array
masked arrays can not be resized inplace .