[Numpy-discussion] 100 Numpy exercices

Nicolas P. Rougier Nicolas.Rougier at inria.fr
Thu May 29 07:38:10 EDT 2014


How would you do that ?

5. Create a vector with values ranging from 10 to 99
9. Create a 5x5 matrix with values 1,2,3,4 just below the diagonal



On 29 May 2014, at 07:04, nicky van foreest <vanforeest at gmail.com> wrote:

> Hi,
> 
> Very helpful, these exercises. 
> 
> Pertaining to exercise 9. Is there a reason not to use the solution of exercise 5? 
> 
> bye
> 
> Nicky
> 
> 
> On 29 May 2014 00:59, Eraldo Pomponi <eraldo.pomponi at gmail.com> wrote:
> It doesn't use stride_tricks, and seberg doesn't quite like it, but this made the rounds in StackOverflow a couple of years ago:
> 
> http://stackoverflow.com/questions/16970982/find-unique-rows-in-numpy-array/16973510#16973510
> 
> It may not work properly on floats, but I think it is a very cool use of dtypes. Then again I'm obviously biased...
> 
> I remained astonished when I discovered this trick just the day before Nicolas posted about his amazing contribution .... and for my use case (int matrices) it is working perfectly ... 
> another candy, again from you Jaime is the fast moving average in: 
> 
> http://stackoverflow.com/a/14314054
> 
> but at a much lower ranking respect to the previous one :P ..... 
> 
> Let me thank you all a lot for making the life of mine and many others easier
> sharing your knowledge. 
> 
> Cheers,
> Eraldo 
> 
> 
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> 
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion




More information about the NumPy-Discussion mailing list