drop_features_operator¶
Remove missing values from one or more dataframes.
-
class
tasrif.processing_pipeline.pandas.drop_features_operator.
DropFeaturesOperator
(feature_names: list)¶ Examples
>>> import pandas as pd >>> import numpy as np >>> >>> from tasrif.processing_pipeline import DropFeaturesOperator >>> >>> df0 = pd.DataFrame([['Tom', 10], ['Alfred', 15], ['Alfred', 18], ['Juli', 14]], columns=['name', 'score']) >>> df1 = pd.DataFrame({"name": ['Alfred', 'juli', 'Tom', 'Ali'], ... "height": [np.nan, 155, 159, 165], ... "born": [pd.NaT, pd.Timestamp("2010-04-25"), pd.NaT, ... pd.NaT]}) >>> >>> operator = DropFeaturesOperator(feature_names=['name']) >>> df0, df1 = operator.process(df0, df1) >>> >>> print(df0) >>> print(df1) name score 0 Tom 10 1 Alfred 15 2 Alfred 18 3 Juli 14 name height born 0 Alfred NaN NaT 1 juli 155.0 2010-04-25 2 Tom 159.0 NaT 3 Ali 165.0 NaT
-
__init__
(feature_names: list)¶ Initializes the operator
- Parameters
feature_names – features (columns) to drop from each dataframe
-
__str__
()¶ Return str(self).
-