Skip to content

Commit 926b5a2

Browse files
committed
python polars 0.14.19
1 parent 87f830d commit 926b5a2

File tree

4 files changed

+39
-14
lines changed

4 files changed

+39
-14
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
use std::fs::File;
2+
3+
use criterion::{criterion_group, criterion_main, Criterion};
4+
use polars::prelude::*;
5+
6+
fn csv_parsing_benchmark(c: &mut Criterion) {
7+
c.bench_function("stream_csv", |b| {
8+
b.iter(|| {
9+
LazyFrame::scan_parquet(
10+
"/home/ritchie46/Downloads/csv-benchmark/yellow_tripdata_2010-01.parquet",
11+
Default::default(),
12+
)
13+
.unwrap()
14+
.groupby([col("rate_code")])
15+
.agg([
16+
col("rate_code").sum(),
17+
col("rate_code").first().alias("first"),
18+
])
19+
.with_streaming(true)
20+
.collect()
21+
})
22+
});
23+
}
24+
25+
criterion_group!(benches, csv_parsing_benchmark);
26+
criterion_main!(benches);

examples/read_csv/src/main.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1+
use polars::io::mmap::MmapBytesReader;
12
use polars::prelude::*;
23

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

14-
dbg!(&df);
15-
16-
write_other_formats(&mut df)?;
15+
// write_other_formats(&mut df)?;
1716
Ok(())
1817
}
1918

py-polars/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

py-polars/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "py-polars"
3-
version = "0.14.18"
3+
version = "0.14.19"
44
authors = ["ritchie46 <[email protected]>"]
55
documentation = "https://pola-rs.github.io/polars/py-polars/html/reference/index.html"
66
edition = "2021"

0 commit comments

Comments
 (0)