b5034279b48ae96ffdd4714f96e0f62b0f4807fc,category_encoders/ordinal.py,OrdinalEncoder,ordinal_encoding,#Any#Any#Any#Any#Any#,239
Before Change
for switch in mapping:
categories_dict = dict(switch.get("mapping"))
column = switch.get("col")
transformed_column = X[column].map(lambda x: categories_dict.get(x, np.nan))
try:
transformed_column = transformed_column.astype(int)
except ValueError as e:
transformed_column = transformed_column.astype(float)
if impute_missing:
After Change
categories = [x for x in pd.unique(X[col].values) if x is not None]
index = []
values = []
for i in range(len(categories)):
index.append(categories[i])
values.append(i + 1)
mapping = pd.Series(data=values, index=index)
mapping_out.append({"col": col, "mapping": mapping, "data_type": X[col].dtype}, )
return X, mapping_out
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: b5034279b48ae96ffdd4714f96e0f62b0f4807fc
Time: 2018-10-26
Author: jcastaldo08@gmail.com
File Name: category_encoders/ordinal.py
Class Name: OrdinalEncoder
Method Name: ordinal_encoding
Project Name: pandas-dev/pandas
Commit Name: 8051248bedd7387babba24c5756c286987c42eb1
Time: 2021-02-21
Author: jbrockmendel@gmail.com
File Name: asv_bench/benchmarks/hash_functions.py
Class Name:
Method Name: setup
Project Name: pandas-dev/pandas
Commit Name: 8051248bedd7387babba24c5756c286987c42eb1
Time: 2021-02-21
Author: jbrockmendel@gmail.com
File Name: asv_bench/benchmarks/hash_functions.py
Class Name: IsinAlmostFullWithRandomInt
Method Name: setup