Skip to content

key_with_lowest_value( ) -> Feature


Retrieves the key with the lowest value in the Cross Aggregate feature. When there are ties, the lexicographically smallest key is returned.


  • Feature
    A new feature object.


Create a new feature by retrieving the key with the lowest value of the dictionary feature:

>>> counts = catalog.get_feature("CustomerProductGroupTotalCost_7d")
>>> new_feature =
>>> = "CustomerProductGroupWithLowestTotalCost_7d"
Preview the features:

>>> 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"}]))
Dictionary feature:

>>> df["CustomerProductGroupTotalCost_7d"].iloc[0]
'{"Chips et Tortillas":2.0,"Colas, Thés glacés et Sodas":10.0,"Crèmes et Chantilly":0.75,"Pains":1.09,"Œufs":1.19}'
New feature:

>>> df["CustomerProductGroupWithLowestTotalCost_7d"].iloc[0]
'Crèmes et Chantilly'