BUG: Fix a bug when indexing np.nan via loc/iloc (GH5016)

closes #5016