This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fmt::Write; | |
use polars::prelude::*; | |
fn make_sorted_array_series(input: Vec<String>, datatype: &DataType) -> Vec<String> { | |
input | |
.into_iter() | |
.map(|s| { | |
let splited = s.split(","); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use polars::prelude::*; | |
fn main() { | |
let s = Series::new("a", 0..100.collect::<Vec<i64>>); | |
println!("{:?}", s.slice(20, 10)); // 20..30 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use polars::prelude::*; // cargo add polars | |
pub fn load_tsv(file_path:&PathBuf) -> DataFrame { | |
let mut df = CsvReader::from_path(file_path) | |
.unwrap() | |
.with_delimiter(b'\t') | |
.infer_schema(None) // if None polars look through all data, so when loading big data it probably takes long time. You can limit the records polars will look into. | |
.has_header(false) // if it has then 'true' | |
.finish() | |
.unwrap(); |