我正在尝试使用featuretools中的entity_from_dataframe函数从数据帧创建实体。如果索引由多个列组成,有没有办法定义它。我不确定是否需要列表、元组或其他数据结构。代码如下:
es=es.entity_from_dataframe(entity_id="credit",
dataframe=credit_df,
index=["ID1","ID2"]
)它会生成以下关于哈希性的错误
TypeError:不可散列的类型:'list‘
发布于 2018-07-06 10:15:02
您只能将单个变量作为索引。在您的示例中,您应该在数据帧中创建一个新列,该列是要使用的两个列的串联
df["index"] = df["ID1"].astype(str) + "_" + df["ID2"].astype(str)然后,您可以在创建实体时使用index作为索引。
https://stackoverflow.com/questions/51201612
复制相似问题