9da9c8edd24bede6eeeeea8739835ea53ca58cbc,category_encoders/one_hot.py,OneHotEncoder,reverse_dummies,#OneHotEncoder#,293

Before Change


                    val = tran_col[prefix_length:]
                    X.loc[X[tran_col] == 1, col] = val
            else:
                value_array = np.array([int(col0[prefix_length:]) for col0 in col_list])
                X[col] = np.dot(X[col_list].values, value_array.T)
            out_cols = [col0 for col0 in out_cols if col0 not in col_list]

        X = X.reindex(columns=out_cols + cols)

After Change


        
        out_cols = X.columns.values
        cols = []
        mapped_columns = []
        for switch in mapping:
            col = switch.get("col")
            mod = switch.get("mapping")
            cols.append(col)

            X[col] = 0
            for column_mapping in mod:
                existing_col = column_mapping.get("new_col_name")
                val = column_mapping.get("val")
                X.loc[X[existing_col] == 1, col] = val
                mapped_columns.append(existing_col)

        out_cols = [col0 for col0 in out_cols if col0 not in mapped_columns]

        return X.reindex(columns=out_cols + cols)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: 9da9c8edd24bede6eeeeea8739835ea53ca58cbc
Time: 2018-10-21
Author: jcastaldo08@gmail.com
File Name: category_encoders/one_hot.py
Class Name: OneHotEncoder
Method Name: reverse_dummies


Project Name: rasbt/mlxtend
Commit Name: a3a539ed60af074ea3459835c788c2e900f3d8c1
Time: 2019-03-31
Author: ackerleytng@gmail.com
File Name: mlxtend/classifier/stacking_cv_classification.py
Class Name: StackingCVClassifier
Method Name: predict_meta_features


Project Name: nilmtk/nilmtk
Commit Name: 626173412d4281b693244e0705a787c4e7c08031
Time: 2014-07-09
Author: jack-list@xlk.org.uk
File Name: nilmtk/metrics.py
Class Name:
Method Name: fraction_energy_assigned_correctly