Skip to content

Commit 0bba73c

Browse files
committed
docs: add docstring for auto bin
1 parent b118a06 commit 0bba73c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

python/rapidstats/bin.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,20 @@ def sqrt(x: ArrayLike) -> int:
194194

195195

196196
def auto(x: ArrayLike) -> int:
197+
"""Determines the bin count by first using the Freedman Diaconis rule. Since the
198+
rule may return a pathologically large number of bins, if Freedman Diaconis returns
199+
a number of bins greater than the square root of the number of observations, use
200+
Doane's rule.
201+
202+
Parameters
203+
----------
204+
x : ArrayLike
205+
206+
Returns
207+
-------
208+
int
209+
Bin count
210+
"""
197211
fd = freedman_diaconis(x)
198212

199213
if fd >= sqrt(x):

0 commit comments

Comments
 (0)