INVOICE Quarter
SDK code to create INVOICE_Quarter¶
Feature description:
Quarter of invoice
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 GROCERYINVOICE event table.
groceryinvoice_view = catalog.get_view("GROCERYINVOICE")
# Get view from GROCERYINVOICE event table.
groceryinvoice_view = catalog.get_view("GROCERYINVOICE")
In [ ]:
Copied!
# Extract quarter date part from Timestamp column for GROCERYINVOICE view.
groceryinvoice_view["Quarter of invoice"] = groceryinvoice_view["Timestamp"].dt.quarter
# Extract quarter date part from Timestamp column for GROCERYINVOICE view.
groceryinvoice_view["Quarter of invoice"] = groceryinvoice_view["Timestamp"].dt.quarter
In [ ]:
Copied!
# Create lookup feature from Quarter of invoice column for invoice entity.
invoice_quarter =\
groceryinvoice_view["Quarter of invoice"].as_feature("INVOICE_Quarter")
# Create lookup feature from Quarter of invoice column for invoice entity.
invoice_quarter =\
groceryinvoice_view["Quarter of invoice"].as_feature("INVOICE_Quarter")
Preview feature¶
Read on the feature primary entity concept
Read on the serving entity concept
In [ ]:
Copied!
#Check the primary entity of the feature'
invoice_quarter.primary_entity
#Check the primary entity of the feature'
invoice_quarter.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 INVOICE_Quarter
invoice_quarter.preview(
preview_table
)
#Preview INVOICE_Quarter
invoice_quarter.preview(
preview_table
)
Save feature¶
In [ ]:
Copied!
# Save feature
invoice_quarter.save()
# Save feature
invoice_quarter.save()
Add description and see feature definition file¶
In [ ]:
Copied!
# Add description
invoice_quarter.update_description(
"Quarter of invoice"
)
# See feature definition file
invoice_quarter.definition
# Add description
invoice_quarter.update_description(
"Quarter of invoice"
)
# See feature definition file
invoice_quarter.definition