Skip to content

Commit

Permalink
Move clone back into obj logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrumiller committed Mar 27, 2024
1 parent 8f35130 commit c860e97
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions crates/polars-core/src/series/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,16 @@ impl Series {
}

pub fn clear(&self) -> Series {
if self.is_empty() {
self.clone()
} else {
match self.dtype() {
#[cfg(feature = "object")]
DataType::Object(_, _) => self.take_slice(&[]).unwrap(),
dt => Series::new_empty(self.name(), dt),
}
match self.dtype() {
#[cfg(feature = "object")]
DataType::Object(_, _) => {
if self.is_empty() {
self.clone()
} else {
self.slice(0, 0)
}
},
dt => Series::new_empty(self.name(), dt),
}
}

Expand Down

0 comments on commit c860e97

Please sign in to comment.