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

comparison operators on boolean series are NotImplemented #6587

Closed
2 tasks done
mingi3314 opened this issue Jan 31, 2023 · 1 comment · Fixed by #6797
Closed
2 tasks done

comparison operators on boolean series are NotImplemented #6587

mingi3314 opened this issue Jan 31, 2023 · 1 comment · Fixed by #6797
Assignees
Labels
bug Something isn't working python Related to Python Polars

Comments

@mingi3314
Copy link

mingi3314 commented Jan 31, 2023

Polars version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of Polars.

Issue description

It is not able to compare a boolean Series and a scalar value.

For example, pl.Series(values=[True, False]).__eq__(True) returns a NotImplemented, whereas pl.Series(values=[True, False]).__eq__([True]) returns a boolean series.

I think we need to broadcast a scalar value to the vector.

Reproducible example

import polars as pl

s = pl.Series("boolean_series", [True, True, True, False])
print(s == True)

Expected behavior

Expected

shape: (4,)
Series: 'boolean_series' [bool]
[
	true
	true
	true
	false
]

Actual

False

Installed versions

---Version info---
Polars: 0.16.1
Index type: UInt32
Platform: Linux-5.15.79.1-microsoft-standard-WSL2-x86_64-with-glibc2.31
Python: 3.9.12 (main, Apr 26 2022, 13:27:20) 
[GCC 9.4.0]
---Optional dependencies---
pyarrow: 10.0.1
pandas: 1.5.2
numpy: 1.24.1
fsspec: <not installed>
connectorx: 0.3.1
xlsx2csv: <not installed>
deltalake: <not installed>
matplotlib: 3.6.2
@alexander-beedie
Copy link
Collaborator

alexander-beedie commented Feb 11, 2023

Fixed; thanks for raising an issue about this edge-case ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python Related to Python Polars
Projects
None yet
2 participants