featurebyte.Feature.cd.get_value¶
get_value(
key: Union[StrictInt, StrictFloat, StrictStr, bool, Feature]
) -> FeatureDescription¶
Retrieves the value of a specific key in the Cross Aggregate feature. The key may either be a lookup feature or a scalar value.
Parameters¶
- key: Union[StrictInt, StrictFloat, StrictStr, bool, Feature]
key to lookup the value for
Returns¶
- Feature
A new Feature object
Examples¶
Create a new feature by getting the value for a particular key:
>>> counts = catalog.get_feature("CustomerProductGroupCounts_7d")
>>> new_feature = counts.cd.get_value("Chips et Tortillas")
>>> new_feature.name = "Chips et Tortillas Value"
>>> features = fb.FeatureGroup([counts, new_feature])
>>> df = features.preview(pd.DataFrame([{"POINT_IN_TIME": "2022-04-15 10:00:00", "GROCERYCUSTOMERGUID": "2f4c1578-29d6-44b7-83da-7c5bfb981fa0"}]))
>>> df["CustomerProductGroupCounts_7d"].iloc[0]
{'Chips et Tortillas': 1, 'Colas, Thés glacés et Sodas': 3, 'Crèmes et Chantilly': 1, 'Pains': 1, 'Œufs': 1}
New feature: