AttributeError: ‘float’ object has no attribute ‘split’4

You are right, such errors mostly caused by NaN representing empty cells. It is common to filter out such data, before applying your further operations, using this idiom on your dataframe df: Alternatively, it may be more handy to use fillna() method to impute (to replace) null values with something default. E.g. all null or NaN‘s can be replaced with the average … Read more

Removing nan values from an array

If you’re using numpy for your arrays, you can also use Equivalently [Thanks to chbrown for the added shorthand] Explanation The inner function, numpy.isnan returns a boolean/logical array which has the value True everywhere that x is not-a-number. As we want the opposite, we use the logical-not operator, ~ to get an array with Trues … Read more