/// Read the file and create the DataFrame.
Read the file and create the DataFrame.
Read the file and create the DataFrame .
fn finish(mut self) -> Result<DataFrame> {
        // It could be that we could not infer schema due to invalid lines.
        // If we have a CsvError or ParserError we half the number of lines we use for
        // schema inference
        let reader = if self.ignore_parser_error && self.max_records.is_some() {
            if self.max_records < Some(1) {
                return Err(PolarsError::Other("Could not infer schema".into()));
            }
            let reader_val;
            loop {
                let rb = clone(&self.reader_builder);
                match rb.build(clone(&self.reader)) {
                    Err(ArrowError::CsvError(_)) | Err(ArrowError::ParseError(_)) => {
                        self.max_records = self.max_records.map(|v| v / 2);
                        self.reader_builder = self.reader_builder.infer_schema(self.max_records);
                    }
                    Err(e) => return Err(PolarsError::ArrowError(e)),
                    Ok(reader) => {
                        reader_val = reader;
                        break;
                    }
                }
            }
            reader_val
        } else {
            self.reader_builder.build(self.reader)?
        };
        finish_reader(reader, self.rechunk, self.ignore_parser_error)
    }
fn finish ( mut self ) -> Result < DataFrame > { // It could be that we could not infer schema due to invalid lines. // If we have a CsvError or ParserError we half the number of lines we use for // schema inference let reader = if self . ignore_parser_error && self . max_records . is_some ( ) { if self . max_records < Some ( 1 ) { return Err ( PolarsError :: Other ( " " . into ( ) ) ) ; } let reader_val ; loop { let rb = clone ( & self . reader_builder ) ; match rb . build ( clone ( & self . reader ) ) { Err ( ArrowError :: CsvError ( _ ) ) | Err ( ArrowError :: ParseError ( _ ) ) => { self . max_records = self . max_records . map ( | v | v / 2 ) ; self . reader_builder = self . reader_builder . infer_schema ( self . max_records ) ; } Err ( e ) => return Err ( PolarsError :: ArrowError ( e ) ) , Ok ( reader ) => { reader_val = reader ; break ; } } } reader_val } else { self . reader_builder . build ( self . reader ) ? } ; finish_reader ( reader , self . rechunk , self . ignore_parser_error ) }
Read the file and create the DataFrame.
Read the file and create the DataFrame .
mut self