0

Suppose I have this equally spaced 'darray':

epslist = np.linspace(-0.1,0.1,12)

Is there a way I can 'insert' a '0' in this 'darray' with the 'ordered' position? By that, in this case, '0' should be added to the middle of epslist, instead of in the end. I don't really know how to do that and which tools I could use. Thanks for the help!!

ZR-
  • 809
  • 1
  • 4
  • 12

1 Answers1

2

Use advanced indexing and concatenation for example:

epslist = np.concatenate((epslist[epslist<0], [0], epslist[epslist>0]))
Julien
  • 13,986
  • 5
  • 29
  • 53