fn rechunk(&mut self) -> Result<&mut Self> {
        let mut all_equal = true;

        let mut it = self.columns.iter();
        let first_s = it
            .next()
            .ok_or_else(|| PolarsError::NoData("no data to rechunk".into()))?;
        let id = first_s.chunk_lengths();

        for s in it {
            let current_id = s.chunk_lengths();
            if current_id != id {
                all_equal = false;
                break;
            }
        }

        // fast path
        if all_equal {
            Ok(self)
        } else {
            self.columns = self
                .columns
                .iter()
                .map(|s| {
                    s.rechunk(Some(&[1]))
                        .expect("can always aggregate to single chunk")
                })
                .collect();
            Ok(self)
        }
    }
/// Ensure all the chunks in the DataFrame are aligned.
Ensure all the chunks in the DataFrame are aligned.
Ensure all the chunks in the DataFrame are aligned .
fn rechunk(&mut self) -> Result<&mut Self> {
        let mut all_equal = true;
        let mut it = self.columns.iter();
        let first_s = it
            .next()
            .ok_or_else(|| PolarsError::NoData("no data to rechunk".into()))?;
        let id = first_s.chunk_lengths();
        for s in it {
            let current_id = s.chunk_lengths();
            if current_id != id {
                all_equal = false;
                break;
            }
        }
        // fast path
        if all_equal {
            Ok(self)
        } else {
            self.columns = self
                .columns
                .iter()
                .map(|s| {
                    s.rechunk(Some(&[1]))
                        .expect("can always aggregate to single chunk")
                })
                .collect();
            Ok(self)
        }
    }
fn rechunk ( & mut self ) -> Result < & mut Self > { let mut all_equal = true ; let mut it = self . columns . iter ( ) ; let first_s = it . next ( ) . ok_or_else ( | | PolarsError :: NoData ( " " . into ( ) ) ) ? ; let id = first_s . chunk_lengths ( ) ; for s in it { let current_id = s . chunk_lengths ( ) ; if current_id != id { all_equal = false ; break ; } } // fast path if all_equal { Ok ( self ) } else { self . columns = self . columns . iter ( ) . map ( | s | { s . rechunk ( Some ( & [ 1 ] ) ) . expect ( " " ) } ) . collect ( ) ; Ok ( self ) } }
Ensure all the chunks in the DataFrame are aligned.
Ensure all the chunks in the DataFrame are aligned .
&mut self
&mut self