1
app_types

{'TARGET': Boolean,
 'FLAG_MOBIL': Boolean,
 'FLAG_EMP_PHONE': Boolean,
 'FLAG_WORK_PHONE': Boolean,
 'FLAG_CONT_MOBILE': Boolean,
 'FLAG_PHONE': Boolean,
 'FLAG_EMAIL': Boolean,
 'REG_REGION_NOT_LIVE_REGION': Boolean,
 'REG_REGION_NOT_WORK_REGION': Boolean,
 'LIVE_REGION_NOT_WORK_REGION': Boolean,
 'REG_CITY_NOT_LIVE_CITY': Boolean,
 'REG_CITY_NOT_WORK_CITY': Boolean,
 'LIVE_CITY_NOT_WORK_CITY': Boolean,
 'FLAG_DOCUMENT_2': Boolean,
 'FLAG_DOCUMENT_3': Boolean,
 'FLAG_DOCUMENT_4': Boolean,
 'FLAG_DOCUMENT_5': Boolean,
 'FLAG_DOCUMENT_6': Boolean,
 'FLAG_DOCUMENT_7': Boolean,
 'FLAG_DOCUMENT_8': Boolean,
 'FLAG_DOCUMENT_9': Boolean,
 'FLAG_DOCUMENT_10': Boolean,
 'FLAG_DOCUMENT_11': Boolean,
 'FLAG_DOCUMENT_12': Boolean,
 'FLAG_DOCUMENT_13': Boolean,
 'FLAG_DOCUMENT_14': Boolean,
 'FLAG_DOCUMENT_15': Boolean,
 'FLAG_DOCUMENT_16': Boolean,
 'FLAG_DOCUMENT_17': Boolean,
 'FLAG_DOCUMENT_18': Boolean,
 'FLAG_DOCUMENT_19': Boolean,
 'FLAG_DOCUMENT_20': Boolean,
 'FLAG_DOCUMENT_21': Boolean,
 'REGION_RATING_CLIENT': Ordinal,
 'REGION_RATING_CLIENT_W_CITY': Ordinal}

I am trying to apply the above dictionary, app_types, to logical_types of add_dataframe at once. so, I wrote the following code, but I get the following error:

import featuretools as ft

es = ft.EntitySet(id="clients")

es = es.add_dataframe(dataframe_name="app_train", dataframe=app_train,
                      index="SK_ID_CURR", logical_types=app_types)
TypeError: Must use an Ordinal instance with order values defined

I want to apply logical_types at once, how can I do that? This error only occurs for ordinal columns

REGION_RATING_CLIENT and REGION_RATING_CLIENT_W_CITY columns of app_train have 1, 2, and 3 as values and are integer types.

Rob
  • 14,746
  • 28
  • 47
  • 65
I guaranteed
  • 259
  • 1
  • 9

1 Answers1

0

Thank you for your question.

In order for the column to be assigned the Ordinal logical type, you must provide an order argument, specifying the ordering of values from low to high.

Since you mentioned the column only takes on the values 1, 2, and 3, you can try changing the last two entries in the app_types dictionary to:

'REGION_RATING_CLIENT': Ordinal(order=[1, 2, 3])

'REGION_RATING_CLIENT_W_CITY': Ordinal(order=[1, 2, 3])

You can reverse the order array if you want 3 to be considered lowest, and 1 to be considered highest.

sbadithe
  • 41
  • 2