Skip to content

Commit

Permalink
allow broadcasts
Browse files Browse the repository at this point in the history
  • Loading branch information
coastalwhite committed Sep 19, 2024
1 parent 39f7b1a commit 19b52cb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion crates/polars-core/src/series/comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ macro_rules! impl_compare {
let (lhs, rhs) = ($self, $rhs);
validate_types(lhs.dtype(), rhs.dtype())?;

polars_ensure!(lhs.len() == rhs.len(), ShapeMismatch: "could not compare between two series of different length ({} != {})", lhs.len(), rhs.len());
polars_ensure!(
lhs.len() == rhs.len() ||

// Broadcast
lhs.len() == 1 ||
rhs.len() == 1,
ShapeMismatch: "could not compare between two series of different length ({} != {})",
lhs.len(),
rhs.len()
);

#[cfg(feature = "dtype-categorical")]
match (lhs.dtype(), rhs.dtype()) {
Expand Down

0 comments on commit 19b52cb

Please sign in to comment.