median

Filtering out outliers in Pandas dataframe with rolling median

风格不统一 提交于 2020-07-06 11:57:38
问题 I am trying to filter out some outliers from a scatter plot of GPS elevation displacements with dates I'm trying to use df.rolling to compute a median and standard deviation for each window and then remove the point if it is greater than 3 standard deviations. However, I can't figure out a way to loop through the column and compare the the median value rolling calculated. Here is the code I have so far import pandas as pd import numpy as np def median_filter(df, window): cnt = 0 median = df[

Filtering out outliers in Pandas dataframe with rolling median

家住魔仙堡 提交于 2020-07-06 11:57:35
问题 I am trying to filter out some outliers from a scatter plot of GPS elevation displacements with dates I'm trying to use df.rolling to compute a median and standard deviation for each window and then remove the point if it is greater than 3 standard deviations. However, I can't figure out a way to loop through the column and compare the the median value rolling calculated. Here is the code I have so far import pandas as pd import numpy as np def median_filter(df, window): cnt = 0 median = df[