/
quickstart.qmd
40 lines (32 loc) · 1.01 KB
/
quickstart.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
title: Quick Start
---
This shows the bare minimum needed to get started with Kaskada.
## Install
Install the latest version.
This uses `kaskada>=0.6.0-a.3` to ensure the pre-release version is installed.
```
pip install kaskada>=0.6.0-a.3
```
See the section on [installation](./installation.qmd) to learn more about installing Kaskada.
## Write a query
The following Python code imports the Kaskada library, creates a session, and loads some CSV data.
It then runs a query to produce a Pandas DataFrame.
```{python}
import asyncio
import kaskada as kd
kd.init_session()
content = "\n".join(
[
"time,key,m,n",
"1996-12-19T16:39:57,A,5,10",
"1996-12-19T16:39:58,B,24,3",
"1996-12-19T16:39:59,A,17,6",
"1996-12-19T16:40:00,A,,9",
"1996-12-19T16:40:01,A,12,",
"1996-12-19T16:40:02,A,,",
]
)
source = await kd.sources.CsvString.create(content, time_column="time", key_column="key")
source.select("m", "n").extend({"sum_m": source.col("m").sum()}).to_pandas()
```