f0a4b4d03fd700c96800dd1d68a2cc0dfc182f83,cheml/preprocessing/handle_missing.py,missing_values,transform,#missing_values#Any#,99

Before Change


        return df
        
    def transform(self, data):
        data = _check_object_col(data, "data")
        // drop null columns
        data.dropna(axis=1, how="all", inplace=True)

        if self.strategy == "zero":
            for col in data.columns:
                data[col].fillna(value=0,inplace=True)                
            return data
        elif self.strategy == "ignore_row":
            data.dropna(axis=0, how="any", inplace=True)
            return data
        elif self.strategy == "ignore_column":
            data.dropna(axis=1, how="any", inplace=True)
            return data
        elif self.strategy == "interpolate":
            data = data.interpolate()
            data.fillna(method="ffill",axis=1, inplace=True) // because of nan in the first and last element of column
            return data
        else:
            msg = "Wrong strategy has been passed"

After Change


        
        if self.strategy == "ignore_row":
            return df[self.mask]
        elif self.strategy == "ignore_column":
            return df.T[self.mask].T
        else:
            msg = "The transform method doesn"t change the dataframe if strategy="zero" or "interpolate". You should fit_transform your new dataframe with those methods."
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 3

Instances


Project Name: hachmannlab/chemml
Commit Name: f0a4b4d03fd700c96800dd1d68a2cc0dfc182f83
Time: 2017-01-04
Author: mojtabah@buffalo.edu
File Name: cheml/preprocessing/handle_missing.py
Class Name: missing_values
Method Name: transform


Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: 3526a6d7d5005d0cb126a39c894ad7f46b441260
Time: 2018-11-17
Author: jcastaldo08@gmail.com
File Name: category_encoders/basen.py
Class Name: BaseNEncoder
Method Name: transform


Project Name: gboeing/osmnx
Commit Name: c178e788a3e34a74a3facff5848baa374f4506fa
Time: 2021-03-13
Author: boeing@usc.edu
File Name: osmnx/stats.py
Class Name:
Method Name: circuity_avg


Project Name: dmnfarrell/pandastable
Commit Name: 9bf47c410efde68615d18265078e9cd317007103
Time: 2017-08-04
Author: farrell.damien@gmail.com
File Name: pandastable/plugins/mdanalysis.py
Class Name:
Method Name: pre_process


Project Name: gboeing/osmnx
Commit Name: b013b12999b16e11a5b965ae3ac0c9301c6888fa
Time: 2021-04-05
Author: boeing@usc.edu
File Name: osmnx/distance.py
Class Name:
Method Name: add_edge_lengths