Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Working through them and noticed a few small things.

For #3, you can make a boolean array with np.ones/np.zeros with the same dtype arg, saves a little bit of space.

ie np.ones((3,3), dtype=bool)

For #14, you can make use of the same compound boolean statements as you can in pandas to make it a bit simpler.

ie a[(a > 5) & (a < 10)]

For #15, this is a built in numpy function.

np.maximum(a,b).

That's as far as I've made it, but I'm really enjoying them.



Thanks for the No.14 man!

However, for No. 15, that is not the point of the exercise.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: