N = 2
t1 = Timer(method1, setupstr).timeit(N)
t2 = Timer('[np.mean([l for l in d if not np.isnan(l)]) for d in dat]',
    setupstr).timeit(N)
t3 = Timer('np.array([r[np.isfinite(r)].mean() for r in dat])', setupstr
    ).timeit(N)
t4 = Timer('np.ma.masked_invalid(dat).mean(axis=1)', setupstr).timeit(N)
t5 = Timer('nanmean(dat,axis=1)', setupstr).timeit(N)
print('Time: %f\tRatio: %f' % (t1, t1 / t1))
print('Time: %f\tRatio: %f' % (t2, t2 / t1))
print('Time: %f\tRatio: %f' % (t3, t3 / t1))
print('Time: %f\tRatio: %f' % (t4, t4 / t1))
print('Time: %f\tRatio: %f' % (t5, t5 / t1))
NumPy: calculate averages with NaNs removed