3

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,

Sasha Tsukanov
  • 1,025
  • 9
  • 20
  • 1
    one question - any reason you can't add this variable to the original dataframe when you create the entity? I ask because this method is planned to be removed in the next release of featuretools to encourage users to do the data prep before creating an entity set. – Max Kanter Sep 25 '18 at 15:14

1 Answers1

2

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
)
Sasha Tsukanov
  • 1,025
  • 9
  • 20