add value to each element in array python -


i have array this

a= np.arange(4).reshape(2,2)  array([[0, 1],[2, 3]]) 

i want add value each element in array. want result return 4 array like

array([[1, 1],[2, 3]])  array([[0, 2],[2, 3]])  array([[0, 1],[3, 3]])  array([[0, 1],[2, 4]]) 

[a + i.reshape(2, 2) in np.identity(4)] 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -