I have a 3D numpy array.
I can modify arbitrary element using simple indexing
D[:,:,0]=myval
D[:,:10,1]=list(range(10))
Sometimes I need to change element(s) at a given index and it is not predetermined at which axis the index refers. I would like to catch the two following cases with a change in variable
D[:,:10,1]=list(range(10)) ->axis 1
D[:10,:,1]=list(range(10)) ->axis 0
Something like:
f(D,axis=0/1,index=1,newval)
np.take. Or construct an indexingtuplenp.takewouldn't help with assignment, would it?