Shahad Althobaiti
Shahad Althobaiti

Reputation: 51

adding a variable to an entity - featuretools

I'm trying to add a new variable to an entity.

I'm trying to add a variable as follows:

es['Product'].add_variable("inventory", data=inventory_series)

however I'm getting this error:

TypeError: 'Series' objects are mutable, thus they cannot be hashed

and if I specify the type argument as an int,

es['Product'].add_variable("inventory", data=inventory_series)

I get a different error:

--> 558         new_v = type(new_id, entity=self)
    559         self.variables.append(new_v)
    560 

TypeError: 'entity' is an invalid keyword argument for this function

is there another way to add a new variable to an Entity?

Thank you,

Upvotes: 3

Views: 169

Answers (1)

Sasha Tsukanov
Sasha Tsukanov

Reputation: 1125

You need to specify type of data in add_variable. I guess you've tried this way:

es['Product'].add_variable('inventory', data=inventory_series, type=int)

and got this error:

TypeError: 'entity' is an invalid keyword argument for this function

But the type must be one from featuretools.variable_types. Like this:

es['Product'].add_variable(
    'inventory',
    data=inventory_series,
    type=ft.variable_types.Ordinal
)

Upvotes: 2

Related Questions