1 | initial version |

Depends what is meant by 'NAN' values.

Depending on whether they are strings or floating-point `NaN`

values,
different tests would detect them.

If they are strings:

```
zz = [x for x in z if x != 'NAN']
```

2 | No.2 Revision |

~~Depends what ~~The question is ~~meant by 'NAN' values.~~about filtering a list, keeping only those
elements in the list that correspond to positive numbers.

~~Depending on whether they ~~This means filtering out all elements that are not positive numbers.

In particular all strings ~~or floating-point ~~must be filtered out.`NaN`

values,
different tests would detect them.

If ~~they ~~the list is known to consist only of numbers and 'NAN',
or only of numbers and any strings, it is easy to filter out strings.

To exclude values that are ~~strings:~~equal to the string 'NAN':

` zz = [x for x in z if x != `~~'NAN']
~~'NAN' and x > 0]

To exclude all strings:

```
zz = [x for x in z if not isinstance(x, str) and x > 0]
```

If list elements can be anything, first check which elements are real numbers, and test positivity for those.

```
import numbers
zz = [x for x in z if isinstance(x, numbers.Real) and x > 0]
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.