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

Histogram function #18

Open
dicom opened this issue Apr 20, 2012 · 1 comment
Open

Histogram function #18

dicom opened this issue Apr 20, 2012 · 1 comment

Comments

@dicom
Copy link

dicom commented Apr 20, 2012

I think it would be nice to have a histogram function for NArray.

Let's say you have an NArray of integer values:

a = NArray.to_na([1,1,1,1,2,2,2,2,2,3,3,3,4])

You would like to know the distribution of data in your NArray. Having a histogram function would be useful:

h = a.histogram
=> {1=>4, 2=>5, 3=>3, 4=>1}

Perhaps there are other ideas for how to return the result, but one way would be to return it in a hash with value (bin) as key and occurances (frequency) as value.

Do you think it is a good idea for NArray?

@masa16
Copy link
Owner

masa16 commented Apr 20, 2012

I considered that the histogram returns the result in an array. Your idea is interesting. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants