Skip to content

featurebyte.Feature.cd.divide

divide(
other: Feature
) -> Feature

Description

Divides all values in the Cross Aggregate feature by a numeric feature. If the divisor is 0 or null for a row, returns null for that row.

Parameters

  • other: Feature
    A numeric feature to use as the divisor.

Returns

  • Feature
    A new Cross Aggregate feature with values divided by the given feature.

Examples

Create a new feature by dividing a dictionary feature by a numeric feature:

>>> counts = catalog.get_feature("CustomerProductGroupCounts_7d")
>>> total = catalog.get_feature("CustomerTotalCount_7d")
>>> new_feature = counts.cd.divide(total)
>>> new_feature.name = "CustomerProductGroupCountsRatio_7d"