Hi@Sravanthi,
You got this error, because your dataset contains null values. So you can apply feature engineering in your dataset before applying your method. You can use pandas to avoid this.
$ import pandas as pd
$ pd.dropna(variable)
Pass your variable in dropna() function. Then try again.
Hope this will help.