Skip to main content

benfordslaw is a python library to test the frequency distribution of leading digits.

Project description

benfordslaw

Python PyPI Version License BuyMeCoffee Github Forks GitHub Open Issues Project Status Downloads Downloads Open In Colab Sphinx DOI

  • benfordslaw is Python package to test if an empirical (observed) distribution differs significantly from a theoretical (expected, Benfords) distribution. The law states that in many naturally occurring collections of numbers, the leading significant digit is likely to be small. This method can be used if you want to test whether your set of numbers may be artificial (or manipulated). If a certain set of values follows Benford's Law then model's for the corresponding predicted values should also follow Benford's Law. Normal data (Unmanipulated) does trend with Benford's Law, whereas Manipulated or fraudulent data does not.

  • Assumptions of the data:

    1. The numbers need to be random and not assigned, with no imposed minimums or maximums.
    2. The numbers should cover several orders of magnitude
    3. Dataset should preferably cover at least 1000 samples. Though Benford's law has been shown to hold true for datasets containing as few as 50 numbers.

⭐️ Star this repo if you like it ⭐️

Install benfordslaw from PyPI

pip install benfordslaw

Import benfordslaw package

from benfordslaw import benfordslaw

Documentation pages

On the documentation pages you can find detailed information about the working of the benfordslaw with many examples.


Examples

References

Citation

Please cite in your publications if this is useful for your research (see citation).

Maintainers

Contribute

  • All kinds of contributions are welcome!
  • If you wish to buy me a Coffee for this work, it is very appreciated :)

Licence

See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

benfordslaw-2.0.1.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

benfordslaw-2.0.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file benfordslaw-2.0.1.tar.gz.

File metadata

  • Download URL: benfordslaw-2.0.1.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for benfordslaw-2.0.1.tar.gz
Algorithm Hash digest
SHA256 dc1e4a084c53406b724eb2f1565d6fb7a06ba1a6c663021bd5ef751c70ecbb26
MD5 77c6a440148924f02c79aeca5cc523ba
BLAKE2b-256 a888732b693462902a790bf83e545e3dded7865a0c142b72e631422e35bb7891

See more details on using hashes here.

File details

Details for the file benfordslaw-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: benfordslaw-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for benfordslaw-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 035b532e614494861ae8dd525ccc94d5748da868eff15f2f4bfafc49193dc57d
MD5 2236818b66e15e95a7940f5e6bad1778
BLAKE2b-256 da588356c8fdd620be3f06d15e4dc79f61b6fc9ce652eabd8cb7c149b2ac476e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page