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

[FIX] util: Fix bincount for object arrays #3831

Merged
merged 1 commit into from
Jun 2, 2019
Merged

Conversation

lanzagar
Copy link
Contributor

Issue

bincount failed for object arrays that contained np.nan, but worked on both float arrays with nans and object arrays without them.
This was a problem since metas are often stored as object arrays and contain primitive variables, for which bincount should work (even if there are missing values).

Description of changes

The array must contain numbers anyway (since it is later converted to int32 for np.bincount), so it should not hurt to cast it to float before checking for nans. Almost all arrays in Orange are either float or object anyway, so this should be a noop for float arrays and a fix for object arrays.

Includes
  • Code changes
  • Tests
  • Documentation

@codecov
Copy link

codecov bot commented May 30, 2019

Codecov Report

Merging #3831 into master will not change coverage.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master    #3831   +/-   ##
=======================================
  Coverage   85.06%   85.06%           
=======================================
  Files         374      374           
  Lines       69148    69148           
=======================================
  Hits        58821    58821           
  Misses      10327    10327

@janezd janezd merged commit 8f4aa5f into biolab:master Jun 2, 2019
@lanzagar lanzagar deleted the bincount branch March 14, 2022 14:43
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

Successfully merging this pull request may close these issues.

3 participants