numpy.pad()

numpy.pad

numpy.pad(array, pad_width, mode=None, **kwargs) [source]

Pads an array.

Parameters:

array : array_like of rank N

Input array

pad_width : {sequence, array_like, int}

Number of values padded to the edges of each axis. ((before_1, after_1), ... (before_N, after_N)) unique pad widths for each axis. ((before, after),) yields same before and after pad for each axis. (pad,) or int is a shortcut for before = after = pad width for all