da3630c4eccc04079e465256786f65d6d87e7b1f,pdpipe/sklearn_stages.py,Scale,_transform,#Scale#Any#Any#,253

Before Change


        return res

    def _transform(self, df, verbose):
        cols_to_exclude = self._exclude_columns.copy()
        if self._exclude_obj_cols:
            obj_cols = list((df.dtypes[df.dtypes == object]).index)
            obj_cols = [x for x in obj_cols if x not in cols_to_exclude]
            cols_to_exclude += obj_cols
        self._col_order = list(df.columns)
        if cols_to_exclude:
            excluded = df[cols_to_exclude]
            apply_to = df[
                [col for col in df.columns if col not in cols_to_exclude]
            ]
        else:
            apply_to = df
        try:
            res = pd.DataFrame(
                data=self._scaler.transform(apply_to),
                index=apply_to.index,
                columns=apply_to.columns,
            )
        except Exception:
            raise PipelineApplicationError(
                "Exception raised when Scale applied to columns {}".format(
                    apply_to.columns
                )
            )
        if cols_to_exclude:
            res = pd.concat([res, excluded], axis=1)
            res = res[self._col_order]
        return res


class TfidfVectorizeTokenLists(PdPipelineStage):

After Change


            )
        if len(unscaled_cols) > 0:
            unscaled = df[unscaled_cols]
            inter_df = pd.concat([inter_df, unscaled], axis=1)
            inter_df = inter_df[col_order]
        return inter_df


class TfidfVectorizeTokenLists(PdPipelineStage):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: shaypal5/pdpipe
Commit Name: da3630c4eccc04079e465256786f65d6d87e7b1f
Time: 2020-02-16
Author: shaypal5@gmail.com
File Name: pdpipe/sklearn_stages.py
Class Name: Scale
Method Name: _transform


Project Name: senarvi/theanolm
Commit Name: b73fc0c21ea55c7d3357fbf633944e1e67db8bdf
Time: 2016-07-31
Author: seppo.git@marjaniemi.com
File Name: theanolm/scoring/latticedecoder.py
Class Name: LatticeDecoder
Method Name: decode


Project Name: shaypal5/pdpipe
Commit Name: da3630c4eccc04079e465256786f65d6d87e7b1f
Time: 2020-02-16
Author: shaypal5@gmail.com
File Name: pdpipe/sklearn_stages.py
Class Name: Scale
Method Name: _fit_transform