Handling unwanted negative numbers
How to handle invalid values like this is an extremely common problem in machine learning, since most datasets contain errors of some kind. 

There are a few ways to do it. For example, you could set them all to 0:

df.loc[df.SoilHumidity &lt; 0, 'SoilHumidity'] = 0


Or you could fill them with the avg(SoilHumidity), and create an extra feature to flag to the model that they were missing:

import numpy as np

df['SoilHumidityInvalid'] = np.where(df.SoilHumidity &lt; 0, 1, 0)

df.loc[df.SoilHumidity &lt; 0, 'SoilHumidity'] = df.SoilHumidity.mean()


Or, you can try to impute them somehow. Either by back or forward filling (I.E. taking the value from the next or the previous row in your dataset) or by creating a model that uses the other features of your dataset to predict what these invalid values should be.

The right method can depend; sometimes domain knowledge guides you (i.e. if you know the sensor can mistakenly read negatives when it should read 0, then you know to fill with 0). Failing that, I would just try a couple of methods and use cross-validation to see which improves your model the most.