ITEM TotalCost
SDK code to create ITEM_TotalCost¶
Feature description:
TotalCost of the item
In [ ]:
Copied!
import featurebyte as fb
fb.use_profile("tutorial")
import featurebyte as fb
fb.use_profile("tutorial")
Activate catalog¶
In [ ]:
Copied!
catalog = fb.Catalog.activate("Grocery Dataset Tutorial")
catalog = fb.Catalog.activate("Grocery Dataset Tutorial")
Get view from table¶
In [ ]:
Copied!
# Get view from INVOICEITEMS item table.
invoiceitems_view = catalog.get_view("INVOICEITEMS")
# Get view from INVOICEITEMS item table.
invoiceitems_view = catalog.get_view("INVOICEITEMS")
In [ ]:
Copied!
# Create lookup feature from TotalCost column for item entity.
item_totalcost =\
invoiceitems_view["TotalCost"].as_feature("ITEM_TotalCost")
# Create lookup feature from TotalCost column for item entity.
item_totalcost =\
invoiceitems_view["TotalCost"].as_feature("ITEM_TotalCost")
Preview feature¶
Read on the feature primary entity concept
Read on the serving entity concept
In [ ]:
Copied!
#Check the primary entity of the feature'
item_totalcost.primary_entity
#Check the primary entity of the feature'
item_totalcost.primary_entity
In [ ]:
Copied!
#Get observation table: 'Preview Table with 10 items'
preview_table = catalog.get_observation_table(
"Preview Table with 10 items"
).to_pandas()
#Get observation table: 'Preview Table with 10 items'
preview_table = catalog.get_observation_table(
"Preview Table with 10 items"
).to_pandas()
In [ ]:
Copied!
#Preview ITEM_TotalCost
item_totalcost.preview(
preview_table
)
#Preview ITEM_TotalCost
item_totalcost.preview(
preview_table
)
Save feature¶
In [ ]:
Copied!
# Save feature
item_totalcost.save()
# Save feature
item_totalcost.save()
Add description and see feature definition file¶
In [ ]:
Copied!
# Add description
item_totalcost.update_description(
"TotalCost of the item"
)
# See feature definition file
item_totalcost.definition
# Add description
item_totalcost.update_description(
"TotalCost of the item"
)
# See feature definition file
item_totalcost.definition