SHARE
TWEET

Untitled

a guest Aug 18th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. iqr_list = []
  2. q1 = age_25percent
  3. q3 = age_75percent
  4. iqr = q3-q1
  5. lower_bound = q1 -(1.5 * iqr)
  6. upper_bound = q3 +(1.5 * iqr)
  7. a = np.array(data_set["Age"])
  8. p98 = np.nanpercentile(a, 98)
  9. p2 = np.nanpercentile(a, 2)
  10. for i, row in data_set.iterrows():
  11.     if data_set.at[i, "Age"] > upper_bound:
  12.         data_set.at[i,'Age'] = p98
  13.     elif data_set.at[i, "Age"] < p2:
  14.         data_set.at[i,'Age'] = p2
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top