问题遇到的现象和发生背景
利用home-credit数据,做特征衍生,
from woodwork.logical_types import Boolean,Ordinal
def bool_type(df):
col_type = {}
for col in df:
# If column is a number with only two values, encode it as a Boolean
if (df[col].dtype != 'object') and (len(df[col].unique()) <= 2):
col_type[col] = Boolean
print('Number of boolean variables: ', len(col_type))
return col_type
train_col_type = bool_type(application_train_new)
train_col_type['REGION_RATING_CLIENT'] = Ordinal
train_col_type['REGION_RATING_CLIENT_W_CITY'] = Ordinal
es = ft.EntitySet(id = 'clients')
es = es.add_dataframe(dataframe_name = 'app', dataframe = application_train_new,
index = 'SK_ID_CURR',
logical_types=train_col_type,)
TypeError: Must use an Ordinal instance with order values defined