Hello guys. How are you all? I hope you all fine. In this tutorial we will learn about **how to remove nan from list in python**. so without wasting time lets learn about of this.

## How to remove nan from list in python

**remove nan from list in python**to remove nan from list in python just

**Use numpy.isnan()**. By using this method you can remove nan from list in python. It is very easy to use. Lets learn about of this by given below example:Output :`import numpy as np mylist = [18,12,float('nan'),25,56,44,float('nan')] print(mylist) newlist = [x for x in mylist if np.isnan(x) == False] print(newlist)`

**[18, 12, nan, 25, 56, 44, nan] [18, 12, 25, 56, 44]****How to remove nan from list in python**to remove nan from list in python just use this method.By using this method you can remove nan from list in python. It is very easy to use. Lets learn about of this by given below example:

Output :`mylist = [18,285,'nan',85,65,44,'nan'] mylist = [str(x) for x in mylist] print(mylist) newlist = [x for x in mylist if x != 'nan'] print(newlist)`

**['18', '285', 'nan', '85', '65', '44', 'nan'] ['18', '285', '85', '65', '44']****remove nan from list python**to remove nan from list in python just use this method.By using this method you can remove nan from list in python. It is very easy to use. Lets learn about of this by given below example:

Output :**['18', '285', 'nan', '85', '65', '44', 'nan'] ['18', '285', '85', '65', '44']**

## Method 1: Use numpy.isnan()

By using this method you can remove nan from list. It is very easy to use. Lets learn about of this by given below example:

```
import numpy as np
mylist = [18,12,float('nan'),25,56,44,float('nan')]
print(mylist)
newlist = [x for x in mylist if np.isnan(x) == False]
print(newlist)
```

Output :

```
[18, 12, nan, 25, 56, 44, nan]
[18, 12, 25, 56, 44]
```

## Method 2: Using loop

By using this method you can remove nan. It is very easy to use. Lets learn about of this by given below example:

```
mylist = [18,285,'nan',85,65,44,'nan']
mylist = [str(x) for x in mylist]
print(mylist)
newlist = [x for x in mylist if x != 'nan']
print(newlist)
```

Output :

```
['18', '285', 'nan', '85', '65', '44', 'nan']
['18', '285', '85', '65', '44']
```

**Conclusion**

It’s all About this Tutorial. Hope all methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which method worked for you?

**Also, Read**