Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/docs/source/src/python/user-guide/lazy/gpu.py
7890 views
1
# --8<-- [start:setup]
2
import polars as pl
3
4
df = pl.LazyFrame({"a": [1.242, 1.535]})
5
6
q = df.select(pl.col("a").round(1))
7
# --8<-- [end:setup]
8
9
# Avoiding requiring the GPU engine for doc build output
10
# --8<-- [start:simple-result]
11
result = q.collect()
12
print(result)
13
# --8<-- [end:simple-result]
14
15
16
# --8<-- [start:engine-setup]
17
q = df.select((pl.col("a") ** 4))
18
19
# --8<-- [end:engine-setup]
20
21
# --8<-- [start:engine-result]
22
result = q.collect()
23
print(result)
24
# --8<-- [end:engine-result]
25
26
# --8<-- [start:fallback-setup]
27
df = pl.LazyFrame(
28
{
29
"key": [1, 1, 1, 2, 3, 3, 2, 2],
30
"value": [1, 2, 3, 4, 5, 6, 7, 8],
31
}
32
)
33
34
q = df.select(pl.col("value").sum().over("key"))
35
36
# --8<-- [end:fallback-setup]
37
38
# --8<-- [start:fallback-result]
39
print(
40
"PerformanceWarning: Query execution with GPU not supported, reason: \n"
41
"<class 'NotImplementedError'>: Grouped rolling window not implemented"
42
)
43
print("# some details elided")
44
print()
45
print(q.collect())
46
# --8<- [end:fallback-result]
47
48