snow_remover.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:scikit-discovery 作者: MITHaystack 项目源码 文件源码
def process(self, obj_data):
        ''' 
        Removes table data with large snow errors

        @param obj_data: Input DataWrapper, will be modified in place
        '''

        bad_stations = []
        sigma_multiplier = self.ap_paramList[0]()

        for label, data in obj_data.getIterator():

            if len(data[data[self.snow_column]==4]) > 0 and len(data[data[self.snow_column]==2]) > 0:
                snow = data[data[self.snow_column]==4].loc[:,self.column_name]
                no_snow = data[data[self.snow_column]==2].loc[:,self.column_name]

                non_snow_std = np.nanstd(no_snow)
                snow_std = np.nanstd(snow)

                if snow_std > sigma_multiplier * non_snow_std:
                    bad_stations.append(label)

        if len(bad_stations) > 0:
            obj_data.removeFrames(bad_stations)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号