Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support bins: option in value_counts #12

Open
mrkn opened this issue Jan 25, 2019 · 0 comments
Open

Support bins: option in value_counts #12

mrkn opened this issue Jan 25, 2019 · 0 comments

Comments

@mrkn
Copy link
Owner

mrkn commented Jan 25, 2019

bins: should be an integer or an array of integers.

If an integer bins is given, the values are grouped into half-open bins.

If an array of integers is given as bins, the array elements represent the lower limits of each bin. The array must increase monotonically.

Example

>> [1, 2, 1, 1, 3, 4, 4, 5, 2, 6].value_counts(bins: 4)
{ (1.0 ... 2.25) => 5,
  (2.25 ... 3.5) => 1,
  (3.5 ... 4.75) => 2,
  (4.75 ... 6.005) => 2 }

>> [1, 2, 1, 1, 3, 4, 4, 5, 2, 6].value_counts(bins: [1, 2, 3, 4, 5, 6], dropna: false)
{ (1 ... 2) => 3,
  (2 ... 3) => 2,
  (3 ... 4) => 1,
  (4 ... 5) => 2,
  (5 ... 6) => 1,
  nil => 1 }

>> [1, 2, 1, 1, 3, 4, 4, 5, 2, 6].value_counts(bins: [1, 3, 5, 7])
{ (1 ... 3) => 5,
  (3 ... 5) => 3,
  (5 ... 7) => 2 }
@mrkn mrkn changed the title Support bin: option in value_counts Support bins: option in value_counts Feb 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant