Remove NaN values from a Pandas series
Pandas
import pandas as pd
import numpy as np
#create series
s = pd.Series([0,4,12,np.NaN,55,np.NaN,2,np.NaN])
#dropna - will work with pandas dataframe as well
s.dropna()
0 0.0
1 4.0
2 12.0
4 55.0
6 2.0
dtype: float64