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

Allow Series.fill_missing/2 to receive infinity and neg_infinity values #484

Conversation

Jhonatannunessilva
Copy link
Contributor

This PR allows the Series.fill_missing/2 function to receive :infinity and :neg_infinity values.

This is part of #467

Before this PR, if you try to send a :infinity or :neg_infinity value to the Series.fill_missing/2 function, an error will be returned:

iex(1)> s1 = Explorer.Series.from_list([1.0, 2.0, nil, 4.5])            
#Explorer.Series<
  Polars[4]
  float [1.0, 2.0, nil, 4.5]
>

iex(2)> Explorer.Series.fill_missing(s1, :infinity)
** (ArgumentError) cannot invoke Explorer.Series.fill_missing/2 with mismatched dtypes: :float and :infinity
    (explorer 0.6.0-dev) lib/explorer/series.ex:3313: Explorer.Series.dtype_mismatch_error/3

iex(2)> Explorer.Series.fill_missing(s1, :neg_infinity)
** (ArgumentError) cannot invoke Explorer.Series.fill_missing/2 with mismatched dtypes: :float and :neg_infinity
    (explorer 0.6.0-dev) lib/explorer/series.ex:3313: Explorer.Series.dtype_mismatch_error/3

After this PR the result is:

iex(2)> Explorer.Series.fill_missing(s1, :infinity)         
#Explorer.Series<
  Polars[4]
  float [1.0, 2.0, Inf, 4.5]
>

iex(3)> Explorer.Series.fill_missing(s1, :neg_infinity)     
#Explorer.Series<
  Polars[4]
  float [1.0, 2.0, -Inf, 4.5]
>

- Now, this function can receive :infinity and :neg_infinity values
Copy link
Member

@philss philss left a comment

Choose a reason for hiding this comment

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

:shipit:

@josevalim josevalim merged commit 7b27cf6 into elixir-explorer:main Jan 24, 2023
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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