def boolean_indexing(v):
    lens = np.array([len(item) for item in v])
mask = lens[:, (None)] > np.arange(lens.max())
out = np.zeros(mask.shape, dtype=int)
out[mask] = np.concatenate(v)
return out
Convert Python sequence to NumPy array, filling missing values