6

I tried to learn featuretools following documentation from featuretools.com.

A error came up: AttributeError: 'EntitySet' object has no attribute 'entity_from_dataframe'

Could you help me? Thank you.

Code:


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

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

Enjoy
  • 143
  • 1
  • 6

2 Answers2

8

I got the answer.

Thank you,Nate.

[NEW version]

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

[OLD version]

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})
Enjoy
  • 143
  • 1
  • 6
3

The documentation you are using is for an older version of Featuretools. You can find the updated Getting Started documentation that works with Featuretools version 1.0 here: https://featuretools.alteryx.com/en/stable/getting_started/getting_started_index.html

Nate Parsons
  • 376
  • 1
  • 2