b = np.pad(a, 1, mode='wrap')
array([[24, 20, 21, 22, 23, 24, 20], [4, 0, 1, 2, 3, 4, 0], [9, 5, 6, 7, 8,
    9, 5], [14, 10, 11, 12, 13, 14, 10], [19, 15, 16, 17, 18, 19, 15], [24,
    20, 21, 22, 23, 24, 20], [4, 0, 1, 2, 3, 4, 0]])
Wrap slice around edges of a 2D array in numpy