Skip to content

Commit

Permalink
python polars 0.14.19
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Oct 15, 2022
1 parent 87f830d commit 926b5a2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 14 deletions.
26 changes: 26 additions & 0 deletions examples/read_csv/benches/streaming.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use std::fs::File;

use criterion::{criterion_group, criterion_main, Criterion};
use polars::prelude::*;

fn csv_parsing_benchmark(c: &mut Criterion) {
c.bench_function("stream_csv", |b| {
b.iter(|| {
LazyFrame::scan_parquet(
"/home/ritchie46/Downloads/csv-benchmark/yellow_tripdata_2010-01.parquet",
Default::default(),
)
.unwrap()
.groupby([col("rate_code")])
.agg([
col("rate_code").sum(),
col("rate_code").first().alias("first"),
])
.with_streaming(true)
.collect()
})
});
}

criterion_group!(benches, csv_parsing_benchmark);
criterion_main!(benches);
23 changes: 11 additions & 12 deletions examples/read_csv/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
use polars::io::mmap::MmapBytesReader;
use polars::prelude::*;

fn main() -> PolarsResult<()> {
let mut df = LazyCsvReader::new("../datasets/foods1.csv")
.finish()?
.select([
// select all columns
all(),
// and do some aggregations
cols(["fats_g", "sugars_g"]).sum().suffix("_summed"),
])
.collect()?;
let file = std::fs::File::open("/home/ritchie46/Downloads/tpch/tables_scale_100/lineitem.tbl")
.unwrap();
let file = Box::new(file) as Box<dyn MmapBytesReader>;
let df = CsvReader::new(file)
.with_delimiter(b'|')
.has_header(false)
.with_chunk_size(10)
.batched(None)
.unwrap();

dbg!(&df);

write_other_formats(&mut df)?;
// write_other_formats(&mut df)?;
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion py-polars/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion py-polars/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "py-polars"
version = "0.14.18"
version = "0.14.19"
authors = ["ritchie46 <ritchie46@gmail.com>"]
documentation = "https://pola-rs.github.io/polars/py-polars/html/reference/index.html"
edition = "2021"
Expand Down

0 comments on commit 926b5a2

Please sign in to comment.