romasha ali

romasha ali

  • NA
  • 94
  • 38.3k

outliers detection using inter quartile range in python

Feb 6 2019 10:21 AM
i have a data of 29 rows and four columns namely 'date' , 'volume' , 'area' , 'variations' now i want to find out outliers using IQR methods using python but i am facing following error.
  
Code: 
Q1 = data.quantile(0.25)
Q3 = data.quantile(0.75)
IQR = Q3 - Q1
print(IQR)
lower=(Q1 - 1.5 * IQR)
upper=(Q3 + 1.5 * IQR)
print((data < lower)|(data > upper))
 
Error:
 
TypeError: Could not operate array([nan]) with block values '<' not supported between instances of 'str' and 'float'