drop_na_operator

Drop NaN values from one or more dataframes

class tasrif.processing_pipeline.pandas.drop_na_operator.DropNAOperator(**kwargs)

Examples

>>> import pandas as pd
>>> import numpy as np
>>> from tasrif.processing_pipeline import DropNAOperator
>>>
>>> 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 = DropNAOperator(axis=0)
>>> 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
1  juli   155.0 2010-04-25
__init__(**kwargs)

Initializes the operator

Parameters

**kwargs – key word arguments passed to pandas DataFrame.dropna method