3

I am trying to create an entity from a dataframe using the entity_from_dataframe function in featuretools. Is there a way to define the index if it comprises of more than one column. I'm unsure if I need a list, tuple or some other data structure. This is the code:

es=es.entity_from_dataframe(entity_id="credit",
                       dataframe=credit_df,
                       index=["ID1","ID2"]
                       )

It generates the following error regarding hashability

TypeError: unhashable type: 'list'

Max Kanter
  • 2,006
  • 6
  • 16
lcampos
  • 31
  • 2

1 Answers1

1

You can only have a single variable be your index. In your case, you should create a new column in your dataframe that is the concatenation of the two columns you want to use

df["index"] = df["ID1"].astype(str) + "_" + df["ID2"].astype(str)

Then, you can use index as the index when creating the entity.

Max Kanter
  • 2,006
  • 6
  • 16