3 ms·
I feel like the numpy version is most concise, most readable, and most array-ish: np.sum(age>17) (Assumes age is a np.array)
by alanbernstein 3y ago
I feel like the numpy version is most concise, most readable, and most array-ish:
np.sum(age>17)
(Assumes age is a np.array)
- RojerGS 3y agoYes, this is VERY close to the APL way: +/ages>17 OP here; maybe I'll add a comment to the article to make the comparison between NumPy and APL for this expression. Thanks!
- leprechaun1066 3y agoAPL (along with Matlab, K, Mathematica, etc.) was one of the influences for NumPy anyway.