forked from pola-rs/polars
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Improve streaming section of the user guide (pola-rs#13750)
- Loading branch information
1 parent
e47c5db
commit b2712b2
Showing
4 changed files
with
62 additions
and
5 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,26 @@ | ||
# --8<-- [start:import] | ||
import polars as pl | ||
# --8<-- [end:import] | ||
|
||
# --8<-- [start:streaming] | ||
q = ( | ||
q1 = ( | ||
pl.scan_csv("docs/data/iris.csv") | ||
.filter(pl.col("sepal_length") > 5) | ||
.group_by("species") | ||
.agg(pl.col("sepal_width").mean()) | ||
) | ||
|
||
df = q.collect(streaming=True) | ||
df = q1.collect(streaming=True) | ||
# --8<-- [end:streaming] | ||
|
||
# --8<-- [start:example] | ||
print(q1.explain(streaming=True)) | ||
|
||
# --8<-- [end:example] | ||
|
||
# --8<-- [start:example2] | ||
q2 = pl.scan_csv("docs/data/iris.csv").with_columns( | ||
pl.col("sepal_length").mean().over("species") | ||
) | ||
|
||
print(q2.explain(streaming=True)) | ||
# --8<-- [end:example2] |
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
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