Method for checking for indexing out nans