Coverage for jstark/features/product_count.py: 100%
12 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-02-25 20:09 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-02-25 20:09 +0000
1"""ProductCount feature"""
2import pyspark.sql.functions as f
3from pyspark.sql import Column
5from .distinctcount_feature import DistinctCount
8class ProductCount(DistinctCount):
9 def column_expression(self) -> Column:
10 return f.col("Product")
12 @property
13 def description_subject(self) -> str:
14 return "Distinct count of Products"
16 @property
17 def commentary(self) -> str:
18 return (
19 "The number of products. Typically the dataframe supplied "
20 + "to this feature will have many transactions for many baskets with "
21 + "many products bought, this feature allows you to determine how many "
22 + "disinct products were bought in those baskets."
23 )