-2

I have a list of timedelta objects like timedelta(seconds=345) and I need a pythonic way to remove outliers from it. For instance I may have:

timedelta_list = [timedelta(seconds=345), timedelta(seconds=445), timedelta(seconds=1225)]

and I need timedelta(seconds=1225) to be removed from this list. Any ideas on how to achieve this?

  • 1
    How do you know `timedelta(seconds=1225)` is an outlier? How do you define outlier? – timgeb May 06 '22 at 11:06
  • Maybe this post can help you. https://stackoverflow.com/questions/23199796/detect-and-exclude-outliers-in-a-pandas-dataframe – Juan May 06 '22 at 11:07
  • a value that stands out abnormally from the total data sample @timgeb – Bogdan Kozlovskyi May 06 '22 at 11:08
  • 1
    @BogdanKozlovskyi you need a mathematical definition a computer can understand. For example: "a value with a z-score greater than 3". – timgeb May 06 '22 at 11:11

0 Answers0