adb2f55d8629b588bba17a5232946b2245c157fc,tests/test_preprocessing.py,,encoded_data,#Any#,32

Before Change


        for cat in col.cat.categories[1:]:
            expected_cat["{}={}".format(nam, cat)] = pd.Series(
                col == cat, dtype=np.float64)
    expected_cat = pd.DataFrame(expected_cat)

    expected_data = pd.concat((data.drop(dat_cat, axis=1), expected_cat), axis=1)
    return expected_data

After Change




def encoded_data(data):
    expected = []
    for nam, col in data.iteritems():
        if hasattr(col, "cat"):
            for cat in col.cat.categories[1:]:
                name = "{}={}".format(nam, cat)
                s = pd.Series(col == cat, dtype=np.float64)
                expected.append((name, s))
        else:
            expected.append((nam, col))

    expected_data = pd.DataFrame.from_items(expected)
    return expected_data


class TestOneHotEncoder(TestCase):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: sebp/scikit-survival
Commit Name: adb2f55d8629b588bba17a5232946b2245c157fc
Time: 2017-07-23
Author: sebp@k-d-w.org
File Name: tests/test_preprocessing.py
Class Name:
Method Name: encoded_data


Project Name: J535D165/recordlinkage
Commit Name: f7a88a2d7e1c37bfba5e6f7dd72b8a75ae9fa50a
Time: 2018-02-25
Author: jonathandebruinhome@gmail.com
File Name: recordlinkage/base.py
Class Name: BaseCompare
Method Name: _compute


Project Name: kengz/SLM-Lab
Commit Name: d670e94d3f8e938858e938b1d3efeac5389a26d3
Time: 2017-12-17
Author: lgraesser@users.noreply.github.com
File Name: slm_lab/experiment/control.py
Class Name: Session
Method Name: run_episode