def simple(self, df): """ detrending using a line drawn through the first and last point. """ data, stats = df["data"], df["stats"] delta = stats["delta"] # get coefficients for forming line x0, x1 = self._make_first_last_time_values(df, data, stats) # get array of deltas data_inds = data.columns.values.astype(int) * delta[:, np.newaxis] # get offsets, subtract from current and return new df offsets = data_inds.astype(int) * x1 + x0 new = data.values - offsets return _new_waveframe_df(df, data=new)
def dropna(self, df, *args, **kwargs): """ Drop data with NaN. """ data = df.data.dropna(*args, **kwargs) df = _new_waveframe_df(df, data=data, allow_size_change=True) return _update_df_times(df, inplace=True)
def fillna(self, df, *args, **kwargs): """ Fill data with NaN. """ data = df.data.fillna(*args, **kwargs) return _new_waveframe_df(df, data=data)
def constant(self, df): """ A simple demeaning on the data via mean subtraction """ data = df.data.values means = np.nanmean(data, axis=1) out = data - means[:, np.newaxis] return _new_waveframe_df(df, data=out)