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'
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With