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

When using getClassJenks function, if you pass a numeric string as the nbClass param, it doesn't work #45

Closed
Jfairfield1 opened this issue Jan 25, 2019 · 2 comments

Comments

@Jfairfield1
Copy link
Contributor

When using the getClassJenks function, I ended up finding out that if I pass in a string value as the nbClass param, it will result in a very slow execution time. After looking at your source code, I noticed that it was appending a 1 to the end of the value instead of the expected addition.

For example, if I called getClassJenks("5") on a series with ~ 4000 rows, it was taking a very long time to return results. ~ 10 seconds

Here is a debugging image from chrome:
image

It looks like in my example, it is looping 51 times instead of 6 times.

Maybe the user should be smart enough to make sure to pass in a number type when calling this function, but I think it would be helpful to try to parse the nbClass value if it a string / log an error if the user passes in a string.

I would be happy to create a pull request to fix this issue if you want. I love this library, it has helped me out quite a bit in the last year.

@simogeo
Copy link
Owner

simogeo commented Jan 26, 2019

Thanks for reporting @Jfairfield1 , I just proposed a fix - implemented on all classification methods
I let you test it.
Come back to me if it does not work correctly. If you want to contribute to the project, you can have a look on issues #22 and / or #30.

@Jfairfield1
Copy link
Contributor Author

Your solution seems to work great! Thanks so much for the quick response. I'd love to jump in and work on the project. I'll take a look at these issues and see how it goes.

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