ENH: compute mask in nanstd/nanmean only once
Merge pull request #2896 from cpcloud/master

ENH: compute mask in nanstd/nanmean only once