Script scans and compares a public financial statement with Benford's distribution. Type in a stock ticker followed by the type of financial statement you would like to look at (cf=cash flow, bs=balance sheet, is=income statement) and a Kolmogorov-Smirnov test will compare how the digits in the financial statement differ from Benford's distribution.
Due to a counting system structured in the base of 10, digits closer to 1 appear more frequently rather than being equally distributed. Benford's law demonstrates this phenomenon in everything from Newton's gravitational constant to financial accounting statements.Comparing Benford's distribution with Enron's last financial statement showing clear mismatch in digit distribution
Example with AMD's cash flow statement by running benford_compare("AMD","cf")
in benfords_law.py