This note assumes that you have already found/identified the outliers. It only says how to deal with them without removing them. If you can get rid of them because you can get the "corrected" data then great, do that. Otherwise you will have to somehow modify them so that they don't screw up model training too much.

Capping/Winsorizing

The idea is to clip values at specified percentiles. Example: 5th and 95th

from scipy.stats.mstats import winsorize

dataframe.loc[:,'colName'] = winsorize(dataframe['colName'], limits=(0.05, 0.05))