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

Before Change


        // 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"
            raise TypeError(msg)

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."
            warnings.warn(msg)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

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: albu/albumentations
Commit Name: 7098243f6055909d307b54743402d389a076215e
Time: 2018-07-24
Author: me@arseny.info
File Name: albumentations/augmentations/functional.py
Class Name:
Method Name: jpeg_compression


Project Name: scipy/scipy
Commit Name: e941098a66d845c2eb8aa42aff1af8688440f071
Time: 2013-08-21
Author: pav@iki.fi
File Name: scipy/sparse/sputils.py
Class Name:
Method Name: getdtype