Skip to main content

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

Project description

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.1.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

benfordslaw-2.1.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: benfordslaw-2.1.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for benfordslaw-2.1.0.tar.gz
Algorithm Hash digest
SHA256 a4acfe4585b4dc00c4bc879e894735592fe87723731b63c25e5f82532cac5735
MD5 5790aa6fc474da68f735581a4febff5a
BLAKE2b-256 d9e21f2e0b621a979261500c89ea51175c682cffbcfcb64b7870be20971f75fc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: benfordslaw-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for benfordslaw-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09cc2cc41cbd107fb68e62c07d88ec78dfe7c938c7fe0e69539df1920efa2442
MD5 f8cdfc2e5f0e5c2b5c716ac4b4febdd9
BLAKE2b-256 5be5b1347d51951e0c0b4e19c22afb5231d0d76f436d9548f7be8fbca8653e07

See more details on using hashes here.

Supported by

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