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

12 statements  

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

1"""ApproxCustomerCount feature""" 

2import pyspark.sql.functions as f 

3from pyspark.sql import Column 

4 

5from .approxdistinctcount_feature import ApproxDistinctCount 

6 

7 

8class ApproxCustomerCount(ApproxDistinctCount): 

9 def column_expression(self) -> Column: 

10 return f.col("Customer") 

11 

12 @property 

13 def description_subject(self) -> str: 

14 return "Approximate distinct count of Customers" 

15 

16 @property 

17 def commentary(self) -> str: 

18 return ( 

19 "The approximate number of customers. Similar to " 

20 + f"CustomerCount_{self.feature_period.mnemonic} " 

21 + "except that it uses an approximation algorithm which " 

22 + "will not be as accurate as " 

23 + f"CustomerCount_{self.feature_period.mnemonic} but will be a lot " 

24 + 'quicker to compute and in many cases will be "close enough".' 

25 )