numpy.ma.expand_dims()

numpy.ma.expand_dims

numpy.ma.expand_dims(x, axis) [source]

Expand the shape of an array.

Expands the shape of the array by including a new axis before the one specified by the axis parameter. This function behaves the same as numpy.expand_dims but preserves masked elements.