captest.capdata.CapData.filter_custom
- CapData.filter_custom(func, *args, custom_name=None, **kwargs)
Apply
functodata_filteredas a row filter and record the step.funcis called asfunc(self.data_filtered, *args, **kwargs)and must return a DataFrame whose index is the rows to keep. Many pandas DataFrame methods qualify, e.g.pd.DataFrame.between_timeorpd.DataFrame.dropna.- Parameters:
func (callable) – Takes a DataFrame as the first argument and returns a DataFrame.
*args – Forwarded to
func.**kwargs – Forwarded to
func.custom_name (str, default None) – Optional display label for the recorded filter step. Keyword-only so it cannot collide with positional args destined for
func.
Notes
The class-based pipeline preserves the original column set: only the returned frame’s index is consumed. A function that drops or transforms columns will see its column changes discarded — pass column-transforming logic outside the filter pipeline.