milcent / benford_py

Python implementation of Benford's Law tests.
BSD 3-Clause "New" or "Revised" License
151 stars 52 forks source link

Bendford py last 2 digits #13

Closed ConnyGarcia closed 6 years ago

ConnyGarcia commented 6 years ago

I have performed every other bendford test but this one requires decimal values:

Last Two Digits Test

L2d = bf.last_two_digits(orders["Order_amount"].astype(int), decimals=1, confidence=99)

Warning

C:\Users\cgarciadiaz\AppData\Local\Continuum\anaconda3\envs\Supplier_DTEC\lib\site-packages\benford\benford.py:471: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy temp['L2D'] = temp.ZN % 100

milcent commented 6 years ago

Thanks Conny, This is a Warning pandas sometimes throws, despite the code is not doing what it is complaining about. I will create an issue to disregard it in production versions of the library. Anyway, I have not seen this influence the test performance. Did it prevent you from getting the results or showing the plot? The decimals parameter is a way to make the function aware of the data decimal places, like 2 in case of money, or 0 if integers.