Better HN
topnewbestaskshowjobs
Log inSign up

loganzk

3 karma · joined Feb 27, 2018 (8y ago) · 1 submissions

Submissions

comment 8y ago · link · parent

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.