Update nanfunctions.py

"All-NaN slice encountered" is raised if there is any NaN instead of if all are nan.