Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
  • Loading branch information
nameexhaustion committed Oct 9, 2024
1 parent 846eb0f commit f6d6345
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
13 changes: 2 additions & 11 deletions crates/polars-core/src/series/arithmetic/borrowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,17 +634,8 @@ impl Div for &Series {
list_borrowed::NumericListOp::Div.execute(self, rhs)
},
_ => {
let leaf_supertype =
try_get_supertype(&self.dtype().leaf_dtype(), &rhs.dtype().leaf_dtype())?;
let leaf_supertype = if leaf_supertype.is_float() {
leaf_supertype
} else {
DataType::Float64
};

let lhs = self.cast(&self.dtype().cast_leaf(leaf_supertype.clone()))?;
let rhs = rhs.cast(&rhs.dtype().cast_leaf(leaf_supertype))?;
lhs.divide(&rhs)
let (lhs, rhs) = coerce_lhs_rhs(self, rhs)?;
lhs.divide(rhs.as_ref())
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions py-polars/polars/series/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,8 +1088,8 @@ def __truediv__(self, other: Any) -> Series | Expr:
self._recursive_cast_to_dtype(Float64())
if not (
self.dtype.is_float()
or self.dtype.is_nested()
or (isinstance(other, Series) and other.dtype.is_nested())
or isinstance(self.dtype, List)
or (isinstance(other, Series) and isinstance(other.dtype, List))
)
else self
)
Expand Down

0 comments on commit f6d6345

Please sign in to comment.