How to interpret the result of concatenation using numpy library in python?

python

#1

I am using numpy library function for concatenation to from the array .I have used the function **np.r_**for concatenation .
for example


But I am unable to understand the result of this function.


#2

@sid100158,

It is interesting to know the result…let’s understand all the three arguments of np.r_.

  • First argument has a constant value 3, if we change it to 5 then in output also, you can see the change
  • Second argument is an 1D array of 5 elements (5 zeros)
  • Third argumentis equivalent to start:stop:step and here step is an imaginary number (i.e. 10j). Its integer portion is interpreted as a number-of-points desired and the start and stop are inclusive. If you will change the 10j to 5j it will only show 5 number between -1 and 1 (look at below snapshot).

Hope this helps!

Regards,
Imran