Question: In my for loop, my code generates a list like this one:

```
list([0.0,0.0]/sum([0.0,0.0]))

```

The loop generates all sort of other number vectors but it also generates `[nan,nan]`, and to avoid it I tried to put in a conditional to prevent it like the one below, but it doesn't return true. 

```
nan in list([0.0,0.0]/sum([0.0,0.0]))
>>> False

```

Shouldn't it return true?

![enter image description here](https://i.stack.imgur.com/aQayL.png)

Libraries I've loaded:

```
import PerformanceAnalytics as perf
import DataAnalyticsHelpers
import DataHelpers as data
import OptimizationHelpers as optim
from matplotlib.pylab import *
from pandas.io.data import DataReader
from datetime import datetime,date,time
import tradingWithPython as twp
import tradingWithPython.lib.yahooFinance as data_downloader # used to get data from yahoo finance
import pandas as pd # as always.
import numpy as np
import zipline as zp
from scipy.optimize import minimize
from itertools import product, combinations
import time
from math import isnan

```

Answer: 
You should use the [`math`](http://docs.python.org/2/library/math.html) module.

```
>>> import math
>>> math.isnan(item)

```
May be this is what you are looking for...

```
a = [2,3,np.nan]
b = True if True in np.isnan(np.array(a)) else False
print(b)

```