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

12 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-02-25 20:09 +0000

1"""MaxNetPrice feature""" 

2import pyspark.sql.functions as f 

3from pyspark.sql import Column 

4 

5from .max_feature import Max 

6 

7 

8class MaxNetPrice(Max): 

9 def column_expression(self) -> Column: 

10 return f.col("NetSpend") / f.col("Quantity") 

11 

12 @property 

13 def description_subject(self) -> str: 

14 return "Maximum of (NetSpend / Quantity)" 

15 

16 @property 

17 def commentary(self) -> str: 

18 return ( 

19 "The net price is calculated as the net " 

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

21 )