diff --git a/polars/polars-core/src/chunked_array/bitwise.rs b/polars/polars-core/src/chunked_array/bitwise.rs index 3640343a6762..3a59a548b5cf 100644 --- a/polars/polars-core/src/chunked_array/bitwise.rs +++ b/polars/polars-core/src/chunked_array/bitwise.rs @@ -117,14 +117,14 @@ impl BitOr for &BooleanChunked { rhs.rename(self.name()); rhs } - None => &self.expand_at_index(0, rhs.len()) | rhs, + None => &self.new_from_index(0, rhs.len()) | rhs, }; } (_, 1) => { return match rhs.get(0) { Some(true) => BooleanChunked::full(self.name(), true, self.len()), Some(false) => self.clone(), - None => &rhs.expand_at_index(0, self.len()) | self, + None => &rhs.new_from_index(0, self.len()) | self, }; } _ => {} @@ -168,14 +168,14 @@ impl BitXor for &BooleanChunked { rhs.rename(self.name()); rhs } - None => &self.expand_at_index(0, rhs.len()) | rhs, + None => &self.new_from_index(0, rhs.len()) | rhs, }; } (_, 1) => { return match rhs.get(0) { Some(true) => self.not(), Some(false) => self.clone(), - None => &rhs.expand_at_index(0, self.len()) | self, + None => &rhs.new_from_index(0, self.len()) | self, }; } _ => {} @@ -218,14 +218,14 @@ impl BitAnd for &BooleanChunked { return match self.get(0) { Some(true) => rhs.clone(), Some(false) => BooleanChunked::full(self.name(), false, rhs.len()), - None => &self.expand_at_index(0, rhs.len()) & rhs, + None => &self.new_from_index(0, rhs.len()) & rhs, }; } (_, 1) => { return match rhs.get(0) { Some(true) => self.clone(), Some(false) => BooleanChunked::full(self.name(), false, self.len()), - None => self & &rhs.expand_at_index(0, self.len()), + None => self & &rhs.new_from_index(0, self.len()), }; } _ => {} diff --git a/polars/polars-core/src/chunked_array/logical/struct_/mod.rs b/polars/polars-core/src/chunked_array/logical/struct_/mod.rs index 53dd8a9c1a25..1ca4c45d44a9 100644 --- a/polars/polars-core/src/chunked_array/logical/struct_/mod.rs +++ b/polars/polars-core/src/chunked_array/logical/struct_/mod.rs @@ -55,7 +55,7 @@ impl StructChunked { if s_len == max_len { new_fields.push(s.clone()) } else if s_len == 1 { - new_fields.push(s.expand_at_index(0, max_len)) + new_fields.push(s.new_from_index(0, max_len)) } else { return Err(PolarsError::ShapeMisMatch( "expected all fields to have equal length".into(), diff --git a/polars/polars-core/src/chunked_array/ops/mod.rs b/polars/polars-core/src/chunked_array/ops/mod.rs index 3f441c509011..9593c5faf5d6 100644 --- a/polars/polars-core/src/chunked_array/ops/mod.rs +++ b/polars/polars-core/src/chunked_array/ops/mod.rs @@ -601,7 +601,7 @@ pub trait ChunkFilter { /// Create a new ChunkedArray filled with values at that index. pub trait ChunkExpandAtIndex { /// Create a new ChunkedArray filled with values at that index. - fn expand_at_index(&self, length: usize, index: usize) -> ChunkedArray; + fn new_from_index(&self, length: usize, index: usize) -> ChunkedArray; } macro_rules! impl_chunk_expand { @@ -622,32 +622,32 @@ where ChunkedArray: ChunkFull + TakeRandom, T: PolarsNumericType, { - fn expand_at_index(&self, index: usize, length: usize) -> ChunkedArray { + fn new_from_index(&self, index: usize, length: usize) -> ChunkedArray { impl_chunk_expand!(self, length, index) } } impl ChunkExpandAtIndex for BooleanChunked { - fn expand_at_index(&self, index: usize, length: usize) -> BooleanChunked { + fn new_from_index(&self, index: usize, length: usize) -> BooleanChunked { impl_chunk_expand!(self, length, index) } } impl ChunkExpandAtIndex for Utf8Chunked { - fn expand_at_index(&self, index: usize, length: usize) -> Utf8Chunked { + fn new_from_index(&self, index: usize, length: usize) -> Utf8Chunked { impl_chunk_expand!(self, length, index) } } #[cfg(feature = "dtype-binary")] impl ChunkExpandAtIndex for BinaryChunked { - fn expand_at_index(&self, index: usize, length: usize) -> BinaryChunked { + fn new_from_index(&self, index: usize, length: usize) -> BinaryChunked { impl_chunk_expand!(self, length, index) } } impl ChunkExpandAtIndex for ListChunked { - fn expand_at_index(&self, index: usize, length: usize) -> ListChunked { + fn new_from_index(&self, index: usize, length: usize) -> ListChunked { let opt_val = self.get(index); match opt_val { Some(val) => ListChunked::full(self.name(), &val, length), @@ -658,7 +658,7 @@ impl ChunkExpandAtIndex for ListChunked { #[cfg(feature = "object")] impl ChunkExpandAtIndex> for ObjectChunked { - fn expand_at_index(&self, index: usize, length: usize) -> ObjectChunked { + fn new_from_index(&self, index: usize, length: usize) -> ObjectChunked { let opt_val = self.get(index); match opt_val { Some(val) => ObjectChunked::::full(self.name(), val.clone(), length), diff --git a/polars/polars-core/src/doc/changelog/v0_7.rs b/polars/polars-core/src/doc/changelog/v0_7.rs index 935f6bc3d033..4d13947ac46e 100644 --- a/polars/polars-core/src/doc/changelog/v0_7.rs +++ b/polars/polars-core/src/doc/changelog/v0_7.rs @@ -13,7 +13,7 @@ //! * Rem trait implemented for Series and ChunkedArrays //! * ChunkedArrays broadcasting arithmetic //! * ChunkedArray/Series `zip_with` operation -//! * ChunkedArray/Series `expand_at_index` operation +//! * ChunkedArray/Series `new_from_index` operation //! * laziness api initiated. //! - Predicate pushdown optimizer //! - Projection pushdown optimizer diff --git a/polars/polars-core/src/frame/arithmetic.rs b/polars/polars-core/src/frame/arithmetic.rs index bed5d785c7c3..c0c2150e694a 100644 --- a/polars/polars-core/src/frame/arithmetic.rs +++ b/polars/polars-core/src/frame/arithmetic.rs @@ -150,7 +150,7 @@ impl DataFrame { // trick to fill a series with nulls let vals: &[Option] = &[None]; let s = Series::new(name, vals).cast(dtype)?; - cols.push(s.expand_at_index(0, max_len)) + cols.push(s.new_from_index(0, max_len)) } } DataFrame::new(cols) diff --git a/polars/polars-core/src/frame/mod.rs b/polars/polars-core/src/frame/mod.rs index 262645631f75..3c3483936c41 100644 --- a/polars/polars-core/src/frame/mod.rs +++ b/polars/polars-core/src/frame/mod.rs @@ -1115,7 +1115,7 @@ impl DataFrame { fn inner(df: &mut DataFrame, mut series: Series) -> PolarsResult<&mut DataFrame> { let height = df.height(); if series.len() == 1 && height > 1 { - series = series.expand_at_index(0, height); + series = series.new_from_index(0, height); } if series.len() == height || df.is_empty() { @@ -1169,7 +1169,7 @@ impl DataFrame { let height = self.height(); if series.len() == 1 && height > 1 { - series = series.expand_at_index(0, height); + series = series.new_from_index(0, height); } if series.len() == height || self.is_empty() { @@ -2042,7 +2042,7 @@ impl DataFrame { let new_col = f(col).into_series(); match new_col.len() { 1 => { - let new_col = new_col.expand_at_index(0, df_height); + let new_col = new_col.new_from_index(0, df_height); let _ = mem::replace(col, new_col); } len if (len == df_height) => { diff --git a/polars/polars-core/src/functions.rs b/polars/polars-core/src/functions.rs index 19ae824c8c41..8fd93b828e42 100644 --- a/polars/polars-core/src/functions.rs +++ b/polars/polars-core/src/functions.rs @@ -156,7 +156,7 @@ pub fn concat_str(s: &[Series], delimiter: &str) -> PolarsResult { let mut ca = s.utf8()?.clone(); // broadcast if ca.len() == 1 && len > 1 { - ca = ca.expand_at_index(0, len) + ca = ca.new_from_index(0, len) } Ok(ca) diff --git a/polars/polars-core/src/series/implementations/binary.rs b/polars/polars-core/src/series/implementations/binary.rs index 8a4f7e81e8c2..54029d148f7f 100644 --- a/polars/polars-core/src/series/implementations/binary.rs +++ b/polars/polars-core/src/series/implementations/binary.rs @@ -227,8 +227,8 @@ impl SeriesTrait for SeriesWrap { self.0.rechunk().into_series() } - fn expand_at_index(&self, index: usize, length: usize) -> Series { - ChunkExpandAtIndex::expand_at_index(&self.0, index, length).into_series() + fn new_from_index(&self, index: usize, length: usize) -> Series { + ChunkExpandAtIndex::new_from_index(&self.0, index, length).into_series() } fn cast(&self, data_type: &DataType) -> PolarsResult { diff --git a/polars/polars-core/src/series/implementations/boolean.rs b/polars/polars-core/src/series/implementations/boolean.rs index 7cbcb2a4c4f9..62b3f9452f80 100644 --- a/polars/polars-core/src/series/implementations/boolean.rs +++ b/polars/polars-core/src/series/implementations/boolean.rs @@ -237,8 +237,8 @@ impl SeriesTrait for SeriesWrap { self.0.rechunk().into_series() } - fn expand_at_index(&self, index: usize, length: usize) -> Series { - ChunkExpandAtIndex::expand_at_index(&self.0, index, length).into_series() + fn new_from_index(&self, index: usize, length: usize) -> Series { + ChunkExpandAtIndex::new_from_index(&self.0, index, length).into_series() } fn cast(&self, data_type: &DataType) -> PolarsResult { diff --git a/polars/polars-core/src/series/implementations/categorical.rs b/polars/polars-core/src/series/implementations/categorical.rs index 7e00596330e4..97e70636b536 100644 --- a/polars/polars-core/src/series/implementations/categorical.rs +++ b/polars/polars-core/src/series/implementations/categorical.rs @@ -285,8 +285,8 @@ impl SeriesTrait for SeriesWrap { self.with_state(true, |ca| ca.rechunk()).into_series() } - fn expand_at_index(&self, index: usize, length: usize) -> Series { - self.with_state(true, |cats| cats.expand_at_index(index, length)) + fn new_from_index(&self, index: usize, length: usize) -> Series { + self.with_state(true, |cats| cats.new_from_index(index, length)) .into_series() } diff --git a/polars/polars-core/src/series/implementations/dates_time.rs b/polars/polars-core/src/series/implementations/dates_time.rs index d1e90f211777..66d9b751ecfb 100644 --- a/polars/polars-core/src/series/implementations/dates_time.rs +++ b/polars/polars-core/src/series/implementations/dates_time.rs @@ -326,9 +326,9 @@ macro_rules! impl_dyn_series { self.0.rechunk().$into_logical().into_series() } - fn expand_at_index(&self, index: usize, length: usize) -> Series { + fn new_from_index(&self, index: usize, length: usize) -> Series { self.0 - .expand_at_index(index, length) + .new_from_index(index, length) .$into_logical() .into_series() } diff --git a/polars/polars-core/src/series/implementations/datetime.rs b/polars/polars-core/src/series/implementations/datetime.rs index 886dd0b964f7..fe17f6cddaeb 100644 --- a/polars/polars-core/src/series/implementations/datetime.rs +++ b/polars/polars-core/src/series/implementations/datetime.rs @@ -352,9 +352,9 @@ impl SeriesTrait for SeriesWrap { .into_series() } - fn expand_at_index(&self, index: usize, length: usize) -> Series { + fn new_from_index(&self, index: usize, length: usize) -> Series { self.0 - .expand_at_index(index, length) + .new_from_index(index, length) .into_datetime(self.0.time_unit(), self.0.time_zone().clone()) .into_series() } diff --git a/polars/polars-core/src/series/implementations/duration.rs b/polars/polars-core/src/series/implementations/duration.rs index 47d58dc0c0b0..53d33e2c62a4 100644 --- a/polars/polars-core/src/series/implementations/duration.rs +++ b/polars/polars-core/src/series/implementations/duration.rs @@ -369,9 +369,9 @@ impl SeriesTrait for SeriesWrap { .into_series() } - fn expand_at_index(&self, index: usize, length: usize) -> Series { + fn new_from_index(&self, index: usize, length: usize) -> Series { self.0 - .expand_at_index(index, length) + .new_from_index(index, length) .into_duration(self.0.time_unit()) .into_series() } diff --git a/polars/polars-core/src/series/implementations/floats.rs b/polars/polars-core/src/series/implementations/floats.rs index ce09a5950a2f..782870496bbc 100644 --- a/polars/polars-core/src/series/implementations/floats.rs +++ b/polars/polars-core/src/series/implementations/floats.rs @@ -293,8 +293,8 @@ macro_rules! impl_dyn_series { self.0.rechunk().into_series() } - fn expand_at_index(&self, index: usize, length: usize) -> Series { - ChunkExpandAtIndex::expand_at_index(&self.0, index, length).into_series() + fn new_from_index(&self, index: usize, length: usize) -> Series { + ChunkExpandAtIndex::new_from_index(&self.0, index, length).into_series() } fn cast(&self, data_type: &DataType) -> PolarsResult { diff --git a/polars/polars-core/src/series/implementations/list.rs b/polars/polars-core/src/series/implementations/list.rs index a6ad67f606b3..d847c01a3cb4 100644 --- a/polars/polars-core/src/series/implementations/list.rs +++ b/polars/polars-core/src/series/implementations/list.rs @@ -159,8 +159,8 @@ impl SeriesTrait for SeriesWrap { self.0.rechunk().into_series() } - fn expand_at_index(&self, index: usize, length: usize) -> Series { - ChunkExpandAtIndex::expand_at_index(&self.0, index, length).into_series() + fn new_from_index(&self, index: usize, length: usize) -> Series { + ChunkExpandAtIndex::new_from_index(&self.0, index, length).into_series() } fn cast(&self, data_type: &DataType) -> PolarsResult { diff --git a/polars/polars-core/src/series/implementations/mod.rs b/polars/polars-core/src/series/implementations/mod.rs index 1746ff7d6bb0..05e7d9487428 100644 --- a/polars/polars-core/src/series/implementations/mod.rs +++ b/polars/polars-core/src/series/implementations/mod.rs @@ -381,8 +381,8 @@ macro_rules! impl_dyn_series { self.0.rechunk().into_series() } - fn expand_at_index(&self, index: usize, length: usize) -> Series { - ChunkExpandAtIndex::expand_at_index(&self.0, index, length).into_series() + fn new_from_index(&self, index: usize, length: usize) -> Series { + ChunkExpandAtIndex::new_from_index(&self.0, index, length).into_series() } fn cast(&self, data_type: &DataType) -> PolarsResult { diff --git a/polars/polars-core/src/series/implementations/object.rs b/polars/polars-core/src/series/implementations/object.rs index 7b62d3dd4ca4..d1b54d9b6c04 100644 --- a/polars/polars-core/src/series/implementations/object.rs +++ b/polars/polars-core/src/series/implementations/object.rs @@ -173,8 +173,8 @@ where self.0.take_every(n).into_series() } - fn expand_at_index(&self, index: usize, length: usize) -> Series { - ChunkExpandAtIndex::expand_at_index(&self.0, index, length).into_series() + fn new_from_index(&self, index: usize, length: usize) -> Series { + ChunkExpandAtIndex::new_from_index(&self.0, index, length).into_series() } fn cast(&self, _data_type: &DataType) -> PolarsResult { diff --git a/polars/polars-core/src/series/implementations/struct_.rs b/polars/polars-core/src/series/implementations/struct_.rs index 985307e76dd4..39cd1ae4c275 100644 --- a/polars/polars-core/src/series/implementations/struct_.rs +++ b/polars/polars-core/src/series/implementations/struct_.rs @@ -235,9 +235,9 @@ impl SeriesTrait for SeriesWrap { out.into_series() } - fn expand_at_index(&self, index: usize, length: usize) -> Series { + fn new_from_index(&self, index: usize, length: usize) -> Series { self.0 - .apply_fields(|s| s.expand_at_index(index, length)) + .apply_fields(|s| s.new_from_index(index, length)) .into_series() } diff --git a/polars/polars-core/src/series/implementations/utf8.rs b/polars/polars-core/src/series/implementations/utf8.rs index f49191fbd1e0..761574e6a7cc 100644 --- a/polars/polars-core/src/series/implementations/utf8.rs +++ b/polars/polars-core/src/series/implementations/utf8.rs @@ -227,8 +227,8 @@ impl SeriesTrait for SeriesWrap { self.0.rechunk().into_series() } - fn expand_at_index(&self, index: usize, length: usize) -> Series { - ChunkExpandAtIndex::expand_at_index(&self.0, index, length).into_series() + fn new_from_index(&self, index: usize, length: usize) -> Series { + ChunkExpandAtIndex::new_from_index(&self.0, index, length).into_series() } fn cast(&self, data_type: &DataType) -> PolarsResult { diff --git a/polars/polars-core/src/series/ops/extend.rs b/polars/polars-core/src/series/ops/extend.rs index b1eee5a84c0d..1872d5110c52 100644 --- a/polars/polars-core/src/series/ops/extend.rs +++ b/polars/polars-core/src/series/ops/extend.rs @@ -17,7 +17,7 @@ impl Series { dt => panic!("{:?} not supported", dt), }; let s = s.cast(self.dtype())?; - let to_append = s.expand_at_index(0, n); + let to_append = s.new_from_index(0, n); let mut out = self.clone(); out.append(&to_append)?; diff --git a/polars/polars-core/src/series/series_trait.rs b/polars/polars-core/src/series/series_trait.rs index 682c960bbcba..5bc7fe60269a 100644 --- a/polars/polars-core/src/series/series_trait.rs +++ b/polars/polars-core/src/series/series_trait.rs @@ -381,17 +381,17 @@ pub trait SeriesTrait: None } - /// Create a new Series filled with values at that index. + /// Create a new Series filled with values from the given index. /// /// # Example /// /// ```rust /// use polars_core::prelude::*; /// let s = Series::new("a", [0i32, 1, 8]); - /// let expanded = s.expand_at_index(2, 4); - /// assert_eq!(Vec::from(expanded.i32().unwrap()), &[Some(8), Some(8), Some(8), Some(8)]) + /// let s2 = s.new_from_index(2, 4); + /// assert_eq!(Vec::from(s2.i32().unwrap()), &[Some(8), Some(8), Some(8), Some(8)]) /// ``` - fn expand_at_index(&self, _index: usize, _length: usize) -> Series { + fn new_from_index(&self, _index: usize, _length: usize) -> Series { invalid_operation_panic!(self) } diff --git a/polars/polars-lazy/polars-plan/src/dsl/functions.rs b/polars/polars-lazy/polars-plan/src/dsl/functions.rs index 75e9efad2f8a..7ddb695fad72 100644 --- a/polars/polars-lazy/polars-plan/src/dsl/functions.rs +++ b/polars/polars-lazy/polars-plan/src/dsl/functions.rs @@ -422,40 +422,40 @@ pub fn datetime(args: DatetimeArgs) -> Expr { let max_len = s.iter().map(|s| s.len()).max().unwrap(); let mut year = s[0].cast(&DataType::Int32)?; if year.len() < max_len { - year = year.expand_at_index(0, max_len) + year = year.new_from_index(0, max_len) } let year = year.i32()?; let mut month = s[1].cast(&DataType::UInt32)?; if month.len() < max_len { - month = month.expand_at_index(0, max_len); + month = month.new_from_index(0, max_len); } let month = month.u32()?; let mut day = s[2].cast(&DataType::UInt32)?; if day.len() < max_len { - day = day.expand_at_index(0, max_len); + day = day.new_from_index(0, max_len); } let day = day.u32()?; let mut hour = s[3].cast(&DataType::UInt32)?; if hour.len() < max_len { - hour = hour.expand_at_index(0, max_len); + hour = hour.new_from_index(0, max_len); } let hour = hour.u32()?; let mut minute = s[4].cast(&DataType::UInt32)?; if minute.len() < max_len { - minute = minute.expand_at_index(0, max_len); + minute = minute.new_from_index(0, max_len); } let minute = minute.u32()?; let mut second = s[5].cast(&DataType::UInt32)?; if second.len() < max_len { - second = second.expand_at_index(0, max_len); + second = second.new_from_index(0, max_len); } let second = second.u32()?; let mut microsecond = s[6].cast(&DataType::UInt32)?; if microsecond.len() < max_len { - microsecond = microsecond.expand_at_index(0, max_len); + microsecond = microsecond.new_from_index(0, max_len); } let microsecond = microsecond.u32()?; @@ -540,7 +540,7 @@ pub fn duration(args: DurationArgs) -> Expr { }; if nanoseconds.len() != max_len { - nanoseconds = nanoseconds.expand_at_index(0, max_len); + nanoseconds = nanoseconds.new_from_index(0, max_len); } if condition(µseconds) { nanoseconds = nanoseconds + (microseconds * 1_000); @@ -947,7 +947,7 @@ pub fn repeat(value: L, n_times: Expr) -> Expr { let n = n.get(0).extract::().ok_or_else(|| { PolarsError::ComputeError(format!("could not extract a size from {:?}", n).into()) })?; - Ok(s.expand_at_index(0, n)) + Ok(s.new_from_index(0, n)) }; apply_binary(lit(value), n_times, function, GetOutput::same_type()) } diff --git a/polars/polars-lazy/src/physical_plan/executors/groupby_partitioned.rs b/polars/polars-lazy/src/physical_plan/executors/groupby_partitioned.rs index 0822d13d3c2c..e45add213275 100644 --- a/polars/polars-lazy/src/physical_plan/executors/groupby_partitioned.rs +++ b/polars/polars-lazy/src/physical_plan/executors/groupby_partitioned.rs @@ -80,7 +80,7 @@ fn run_partitions( if agg.len() == 1 { Ok(match groups.len() { 0 => agg.slice(0, 0), - len => agg.expand_at_index(0, len) + len => agg.new_from_index(0, len) }) } else { Err(PolarsError::ComputeError( diff --git a/polars/polars-lazy/src/physical_plan/executors/mod.rs b/polars/polars-lazy/src/physical_plan/executors/mod.rs index 706d23339776..0de4750859b2 100644 --- a/polars/polars-lazy/src/physical_plan/executors/mod.rs +++ b/polars/polars-lazy/src/physical_plan/executors/mod.rs @@ -206,7 +206,7 @@ fn check_expand_literals( .into_iter() .map(|series| { if series.len() == 1 && df_height > 1 { - Ok(series.expand_at_index(0, df_height)) + Ok(series.new_from_index(0, df_height)) } else if series.len() == df_height || series.len() == 0 { Ok(series) } else { diff --git a/polars/polars-lazy/src/physical_plan/expressions/mod.rs b/polars/polars-lazy/src/physical_plan/expressions/mod.rs index 881af996ede8..19655d78e2d0 100644 --- a/polars/polars-lazy/src/physical_plan/expressions/mod.rs +++ b/polars/polars-lazy/src/physical_plan/expressions/mod.rs @@ -418,7 +418,7 @@ impl<'a> AggregationContext<'a> { AggState::Literal(s) => { self.groups(); let rows = self.groups.len(); - let s = s.expand_at_index(0, rows); + let s = s.new_from_index(0, rows); s.reshape(&[rows as i64, -1]).unwrap() } } @@ -433,7 +433,7 @@ impl<'a> AggregationContext<'a> { let s = s.clone(); self.groups(); let rows = self.groups.len(); - s.expand_at_index(0, rows) + s.new_from_index(0, rows) } _ => self.aggregated(), } @@ -465,7 +465,7 @@ impl<'a> AggregationContext<'a> { // we allocated enough unsafe { offsets.push_unchecked(last_offset) }; } - let values = s.expand_at_index(0, last_offset as usize); + let values = s.new_from_index(0, last_offset as usize); let values = values.array_ref(0).clone(); // Safety: // offsets are monotonically increasing diff --git a/polars/polars-lazy/src/physical_plan/expressions/ternary.rs b/polars/polars-lazy/src/physical_plan/expressions/ternary.rs index a384756334c3..65721b4b5245 100644 --- a/polars/polars-lazy/src/physical_plan/expressions/ternary.rs +++ b/polars/polars-lazy/src/physical_plan/expressions/ternary.rs @@ -35,13 +35,13 @@ fn expand_lengths(truthy: &mut Series, falsy: &mut Series, mask: &mut BooleanChu let len = std::cmp::max(std::cmp::max(truthy.len(), falsy.len()), mask.len()); if len > 1 { if falsy.len() == 1 { - *falsy = falsy.expand_at_index(0, len); + *falsy = falsy.new_from_index(0, len); } if truthy.len() == 1 { - *truthy = truthy.expand_at_index(0, len); + *truthy = truthy.new_from_index(0, len); } if mask.len() == 1 { - *mask = mask.expand_at_index(0, len); + *mask = mask.new_from_index(0, len); } } } diff --git a/polars/polars-ops/src/chunked_array/list/namespace.rs b/polars/polars-ops/src/chunked_array/list/namespace.rs index 45a4a0c50c51..ec7949912bfb 100644 --- a/polars/polars-ops/src/chunked_array/list/namespace.rs +++ b/polars/polars-ops/src/chunked_array/list/namespace.rs @@ -42,7 +42,7 @@ fn cast_rhs( if s.len() == 1 { if allow_broadcast { // broadcast JIT - *s = s.expand_at_index(0, length) + *s = s.new_from_index(0, length) } // else do nothing } else {