python - 向实体添加变量 - featuretools

标签 python featuretools

我正在尝试向实体添加新变量。

我正在尝试添加如下变量:

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

但是我收到了这个错误:

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

如果我将类型参数指定为 int,

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

我得到一个不同的错误:

--> 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

有没有另一种方法可以将新变量添加到实体中?

谢谢,

最佳答案

您需要在add_variable 中指定数据类型。我猜你已经尝试过这种方式:

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

得到这个错误:

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

但是类型必须是featuretools.variable_types中的一个.像这样:

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

关于python - 向实体添加变量 - featuretools,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52492335/

相关文章:

Python视频编辑——如何修剪视频

用于 MySQL 查询执行的 python StringBuilder

python - 在 Python 中编译搜索模式

python - FeatureTools:处理多对多关系

python - Featuretools 分类处理

python - 从 Python featuretools 中的特征工程中排除当前行

python - Python 中的 Zip 列表

python - 如何通过 Docker 使用 Buildozer 构建 .aab?

python - 如何使用Featuretools为没有直接特征的单个表创建特征?

featuretools - 使用 featuretools 为预测模型生成标签