Benford Package¶
benford.benford module¶
Benford’s Law applied to files sizes on a local hard drive.
Note: this is a ‘hacky’ version - it works but is NOT very Pythonic
-
class
benford.benford.BenfordDigit(experiment_name, digit_position)[source]¶ Bases:
objectTests whether given number digits adhere to Benford’s Law.
-
__experiment_name¶ string – Unique label for each Benford test
-
__digit_position¶ int – significand = 1, 2nd digit, counting from LHS = 2, etc
-
__digit_count¶ dict – Tally of numbers encountered in given digit position
-
__current_number¶ int – Most recent number reported in digit position, used to increment the corrsponding entry in digit_count tally
-
__number_count¶ int – Sum of all numbers found in a given digit_position
-
__digit_percent¶ list – List of percentages corresponding to relative frequencies for each number for a given digit_position (1-9 for significand, or 0-9 otherwise)
-
current_number¶
-
digit_count¶
-
digit_percent¶
-
digit_position¶
-
experiment_name¶
-
number_count¶
-
benford.predictions module¶
Benford’s predictions for the relative frequencies of numbers.
Successive digit positions are considered individually, starting with the significand and proceeding from left to right towards the least significant digit position.