Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- b = np.array([
- [1, 2, 3],
- [4, 5, 6],
- [7, 8, 9]
- ], dtype='float')
- b = np.concatenate((np.transpose([b[:, 0]]), b), axis=1) # left
- b = np.concatenate((b, np.transpose([b[:, -1]])), axis=1) # right
- b = np.concatenate(([b[0, :]], b), axis=0) # up
- b = np.concatenate((b, [b[-1, :]]), axis=0) # down
- print(b)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement