[featuretools]“EntitySet”对象没有属性“entity_from_dataframe”

Enj*_*joy 6 python featuretools

我尝试按照 featuretools.com 的文档来学习 featuretools。

出现错误:AttributeError:“EntitySet”对象没有属性“entity_from_dataframe”

你可以帮帮我吗?谢谢。

代码:


import featuretools as ft

data = ft.demo.load_mock_customer()
transactions_df = data["transactions"].merge(data["sessions"]).merge(data["customers"])
transactions_df.sample(10)
products_df = data["products"]
products_df
es = ft.EntitySet(id="customer_data")
es = es.entity_from_dataframe(entity_id="transactions",
                              dataframe=transactions_df,
                             index="transaction_id",
                              time_index="transaction_time",
                              variable_types={"product_id": ft.variable_types.Categorical,
                                               "zip_code": ft.variable_types.ZIPCode})

es
Run Code Online (Sandbox Code Playgroud)

代码来源:https://docs.featuretools.com/en/v0.16.0/loading_data/using_entitysets.html#creating-entity-from-existing-table

Enj*_*joy 8

我得到了答案。

谢谢你,内特。

[新版本]

https://featuretools.alteryx.com/en/stable/getting_started/getting_started_index.html

from woodwork.logical_types import Categorical, PostalCode

es = es.add_dataframe(
    dataframe_name="transactions",
    dataframe=transactions_df,
    index="transaction_id",
    time_index="transaction_time",
    logical_types={
        "product_id": Categorical,
        "zip_code": PostalCode,
    },
)

es
Run Code Online (Sandbox Code Playgroud)

[旧版]

https://docs.featuretools.com/en/v0.16.0/loading_data/using_entitysets.html#creating-entity-from-existing-table

es = es.entity_from_dataframe(entity_id="transactions",
                              dataframe=transactions_df,
                             index="transaction_id",
                              time_index="transaction_time",
                              variable_types={"product_id": ft.variable_types.Categorical,
                                               "zip_code": ft.variable_types.ZIPCode})
Run Code Online (Sandbox Code Playgroud)


小智 3

您正在使用的文档适用于旧版本的Featuretools。您可以在此处找到适用于 Featuretools 1.0 版的更新后的入门文档: https: //featuretools.alteryx.com/en/stable/getting_started/getting_started_index.html