featurebyte.Feature.cd.key_with_lowest_value¶
key_with_lowest_value( ) -> Feature
Description¶
Retrieves the key with the lowest value in the Cross Aggregate feature. When there are ties, the lexicographically smallest key is returned.
Returns¶
- Feature
A new feature object.
Examples¶
Create a new feature by retrieving the key with the lowest value of the dictionary feature:
>>> counts = catalog.get_feature("CustomerProductGroupTotalCost_7d")
>>> new_feature = counts.cd.key_with_lowest_value()
>>> new_feature.name = "CustomerProductGroupWithLowestTotalCost_7d"
>>> 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"}]))