Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/py-polars/tests/benchmark/test_io.py
6939 views
1
"""Benchmark tests for the I/O operations."""
2
3
from pathlib import Path
4
5
import pytest
6
7
import polars as pl
8
9
pytestmark = pytest.mark.benchmark()
10
11
12
def test_write_read_scan_large_csv(groupby_data: pl.DataFrame, tmp_path: Path) -> None:
13
tmp_path.mkdir(exist_ok=True)
14
15
data_path = tmp_path / "data.csv"
16
groupby_data.write_csv(data_path)
17
18
predicate = pl.col("v2") < 5
19
20
shape_eager = pl.read_csv(data_path).filter(predicate).shape
21
shape_lazy = pl.scan_csv(data_path).filter(predicate).collect().shape
22
23
assert shape_lazy == shape_eager
24
25