Coverage for jstark / features / min_gross_price.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-23 22:34 +0000

1"""MinGrossPrice feature""" 

2 

3import pyspark.sql.functions as f 

4from pyspark.sql import Column 

5 

6from jstark.features.min_feature import Min 

7 

8 

9class MinGrossPrice(Min): 

10 def column_expression(self) -> Column: 

11 return f.try_divide(f.col("GrossSpend"), f.col("Quantity")) 

12 

13 @property 

14 def description_subject(self) -> str: 

15 return "Minimum of (GrossSpend / Quantity)" 

16 

17 @property 

18 def commentary(self) -> str: 

19 return ( 

20 "The net price is calculated as the gross " 

21 + "spend divided by how many were bought." 

22 )