-
benfordslawis 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:
- The numbers need to be random and not assigned, with no imposed minimums or maximums.
- The numbers should cover several orders of magnitude
- 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
- https://en.wikipedia.org/wiki/Benford%27s_law
- https://towardsdatascience.com/frawd-detection-using-benfords-law-python-code-9db8db474cf8
- Hai Wang et al, Last Digit Tendency: Lucky Numbers and Psychological Rounding in Mobile Transactions
Citation
Please cite in your publications if this is useful for your research (see citation).
Maintainers
- Erdogan Taskesen, github: erdogant
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.
Metadata
Release files for benfordslaw 2.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| benfordslaw-2.1.1.tar.gz | 15.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| benfordslaw-2.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.7 kB
Release files / benfordslaw-2.1.1.tar.gz
| Download URL | benfordslaw-2.1.1.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8aefbd63ea5c989ee47a8ef69417b4809cfa68f1243ad9d5c731ca3cbb6c805
|
|
BLAKE2b-256 checksum How to use checksums |
63b070c611c66f4861f99cedc7e069c6e39cc96ea9ea5fccb49a0730b9341ce2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / benfordslaw-2.1.1-py3-none-any.whl
| Download URL | benfordslaw-2.1.1-py3-none-any.whl |
|---|---|
| Size | 15.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b5ed301ffbd3914d4b72633fab52f17731e01b7d058caaa18c1da1b09b29a7a
|
|
BLAKE2b-256 checksum How to use checksums |
7c13bf59a1628a9b72acd98d466ab3941f9d23a9b181ed08c34c8783fedfddbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for benfordslaw 2.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.