-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Change Series.equals
to ignore name by default
#13231
Comments
Agreed - if you want to check whether the names are equal as well, you can test for |
There is also the https://pola-rs.github.io/polars/py-polars/html/reference/testing.html#asserts >>> pl.testing.assert_series_equal(s1, s2)
# AssertionError: Series are different (name mismatch)
# [left]: a
# [right]: b >>> pl.testing.assert_series_equal(s1, s2, check_names=False)
>>> print("Equal!")
# Equal! |
Thanks for the link! I wouldn't want to depend on testing utils in my application though. |
It's not a bug. But I also think it makes more sense for |
Series.equals
to ignore name by default
@stinodego To preserve existing behavior and avoid a breaking change, shouldn't the default |
To do this properly, you would add a parameter Happy to review a PR for this 👍 |
Hello! Long time lurker, (potentially) first time contributor. This type of change sounds like a good first issue to me, but I see it doesn't have that label. @stinodego do you think this is a good first issue? If so, would you be willing to assign me to it (since I can't on my own)? Or should I just make the changes without being assigned. |
I did some exploring and I have a question. Why is this operator's implementation located in a test utilities file? crates/polars-core/src/testing.rs |
pl.Series([1, None, 3]).eq( pl.Series([1, 2, 3]) )
# shape: (3,)
# Series: '' [bool]
# [
# true
# null # <- null is propagated
# true
# ] pl.Series([1, None, 3]).eq_missing( pl.Series([1, 2, 3]) )
# shape: (3,)
# Series: '' [bool]
# [
# true
# false
# true
# ] pl.Series([1, None, 3]).eq_missing( pl.Series([1, None, 3]) )
# shape: (3,)
# Series: '' [bool]
# [
# true
# true
# true
# ] There doesn't seem to be doc entries for the Series API, but: https://docs.pola.rs/docs/python/dev/reference/expressions/api/polars.Expr.eq_missing.html#polars.Expr.eq_missing should help. |
It could be a good first issue, depends on your skillset! Note that the change must be made in Rust. Deprecation must happen on the Python side. |
Checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
Reproducible example
Log output
No response
Issue description
It looks like
Series.equals
requires the header names to be equal in order to return true. This surprised me, but I'm unsure what the intended behavior is. Pandas does not take the headers into account e.g.I would have expected Polars to behave the same way.
If intended, it's probably worth clarifying this in the documentation.
Expected behavior
Installed versions
The text was updated successfully, but these errors were encountered: