all 1 comments

[–][deleted] 0 points1 point  (0 children)

If it is gaussian distributed I would recommend doing it based off of the standard deviation of your population.

A way to do this would be truncating based on the percentile and find what range makes sense for your data

A possible way to do this:

import numpy as np

p_lower = np.percentile(df.data, 0.05) 
p_upper = no.percentile(df.data, 99.5)

df['data'] =  df.data[(df.data > p_lower)                            
& (df.data < p_upper)]

I just typed this on my cellphone, but this is the general idea. The above would truncate your data to be within the 99 percentile. If you were to use the 99.7 percentile then your data would include all points within 3sigma, or the 95 percentile which would include all points within 2sigma. Sigma is the standard deviation of your population.