Skip to content

Conversation

paddyroddy
Copy link
Contributor

Fixes #304. This is still in progress but want to see what would happen in CI.

nan_to_num is a weird function that has unexpected behaviour IMO (e.g. infinities are converted too) but feel, for now, we should keep it as downstream behaviours would expect.

paddyroddy and others added 2 commits August 22, 2025 16:35
Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
@lucascolley lucascolley added this to the 0.8.1 milestone Aug 22, 2025
@lucascolley lucascolley added enhancement New feature or request new function labels Aug 22, 2025
@lucascolley lucascolley changed the title Implement nan_to_num function ENH: Implement nan_to_num function Aug 22, 2025
@paddyroddy
Copy link
Contributor Author

paddyroddy commented Aug 22, 2025

Have addressed your comments.

  • Let me know when you've tested in sklearn

@lucascolley
Copy link
Member

ran this through sklearn and nothing immediately complained! Once we have some more tests here, lets merge it and make a release, then try to integrate it into scikit-learn 👍

@lucascolley lucascolley modified the milestones: 0.8.1, 0.9.0 Aug 26, 2025
@paddyroddy paddyroddy marked this pull request as ready for review August 27, 2025 11:32
@paddyroddy paddyroddy requested a review from lucascolley August 27, 2025 11:32
@paddyroddy
Copy link
Contributor Author

I've added more tests @lucascolley. The main change is fill_value can no longer be complex — which reflects the behaviour in NumPy.

Copy link
Member

@lucascolley lucascolley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @paddyroddy, this looks great!

paddyroddy and others added 3 commits August 27, 2025 18:05
Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
@lucascolley
Copy link
Member

let me release a 0.8.2 with this tonight and make a PR integrating it into sklearn

@lucascolley lucascolley modified the milestones: 0.9.0, 0.8.2 Aug 27, 2025
@lucascolley lucascolley merged commit a2891f7 into data-apis:main Aug 27, 2025
10 checks passed
@paddyroddy paddyroddy deleted the paddyroddy/304 branch August 27, 2025 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new function
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: add nan_to_num
2 participants