Skip to content

Commit a8f9e2d

Browse files
add marimo examples
1 parent e9de487 commit a8f9e2d

File tree

8 files changed

+382
-0
lines changed

8 files changed

+382
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import marimo
2+
3+
__generated_with = "0.13.0"
4+
app = marimo.App(width="medium")
5+
6+
7+
@app.cell
8+
def _():
9+
threshold = 30
10+
return (threshold,)
11+
12+
13+
@app.cell
14+
def _(threshold):
15+
data = [20, 40, 60, 80]
16+
filtered = [x for x in data if x > threshold]
17+
print(filtered)
18+
return
19+
20+
21+
@app.cell
22+
def _():
23+
return
24+
25+
26+
if __name__ == "__main__":
27+
app.run()
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "bb7da31d-3876-43a2-b5b6-cee60a62627b",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"threshold = 50"
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": 2,
16+
"id": "73f3d03b-9167-4295-9350-e8232a7f3d83",
17+
"metadata": {},
18+
"outputs": [
19+
{
20+
"name": "stdout",
21+
"output_type": "stream",
22+
"text": [
23+
"[60, 80]\n"
24+
]
25+
}
26+
],
27+
"source": [
28+
"data = [20, 40, 60, 80]\n",
29+
"filtered = [x for x in data if x > threshold]\n",
30+
"print(filtered)"
31+
]
32+
},
33+
{
34+
"cell_type": "code",
35+
"execution_count": null,
36+
"id": "81b065eb-3eea-4f61-b1f5-8ec1d46a2737",
37+
"metadata": {},
38+
"outputs": [],
39+
"source": []
40+
}
41+
],
42+
"metadata": {
43+
"kernelspec": {
44+
"display_name": "Python 3 (ipykernel)",
45+
"language": "python",
46+
"name": "python3"
47+
},
48+
"language_info": {
49+
"codemirror_mode": {
50+
"name": "ipython",
51+
"version": 3
52+
},
53+
"file_extension": ".py",
54+
"mimetype": "text/x-python",
55+
"name": "python",
56+
"nbconvert_exporter": "python",
57+
"pygments_lexer": "ipython3",
58+
"version": "3.9.6"
59+
}
60+
},
61+
"nbformat": 4,
62+
"nbformat_minor": 5
63+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import marimo
2+
3+
__generated_with = "0.13.0"
4+
app = marimo.App(width="medium")
5+
6+
7+
@app.cell
8+
def _():
9+
from marimo import ui
10+
11+
multiplier = ui.slider(1, 10, 3, label="Multiplier")
12+
multiplier
13+
return (multiplier,)
14+
15+
16+
@app.cell
17+
def _(multiplier):
18+
result = [x * multiplier.value for x in range(5)]
19+
print(result)
20+
return
21+
22+
23+
if __name__ == "__main__":
24+
app.run()
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# /// script
2+
# requires-python = ">=3.11"
3+
# dependencies = [
4+
# "marimo",
5+
# "numpy==2.2.5",
6+
# "pandas==2.2.3",
7+
# ]
8+
# ///
9+
10+
11+
import marimo
12+
13+
__generated_with = "0.13.0"
14+
app = marimo.App(width="medium")
15+
16+
17+
@app.cell
18+
def _():
19+
import numpy as np
20+
import pandas as pd
21+
22+
np.random.seed(1)
23+
df = pd.DataFrame({"value": np.random.randn(5)})
24+
print(df)
25+
return
26+
27+
28+
if __name__ == "__main__":
29+
app.run()
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "82e65582-f723-4e3f-8098-b42044ae85ff",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"data = [1, 2, 3]"
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": 4,
16+
"id": "f5661f3b-7b25-4a51-91f2-8f0feca3739e",
17+
"metadata": {},
18+
"outputs": [
19+
{
20+
"name": "stdout",
21+
"output_type": "stream",
22+
"text": [
23+
"Sum: 60\n"
24+
]
25+
}
26+
],
27+
"source": [
28+
"summary = sum(data)\n",
29+
"print(\"Sum:\", summary)"
30+
]
31+
},
32+
{
33+
"cell_type": "code",
34+
"execution_count": 3,
35+
"id": "9a54c42c-7a41-4a49-b334-6c4086784a84",
36+
"metadata": {},
37+
"outputs": [],
38+
"source": [
39+
"data = [10, 20, 30]"
40+
]
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": null,
45+
"id": "233e800c-11aa-4240-a5b7-21a1543ec947",
46+
"metadata": {},
47+
"outputs": [],
48+
"source": []
49+
}
50+
],
51+
"metadata": {
52+
"kernelspec": {
53+
"display_name": "Python 3 (ipykernel)",
54+
"language": "python",
55+
"name": "python3"
56+
},
57+
"language_info": {
58+
"codemirror_mode": {
59+
"name": "ipython",
60+
"version": 3
61+
},
62+
"file_extension": ".py",
63+
"mimetype": "text/x-python",
64+
"name": "python",
65+
"nbconvert_exporter": "python",
66+
"pygments_lexer": "ipython3",
67+
"version": "3.9.6"
68+
}
69+
},
70+
"nbformat": 4,
71+
"nbformat_minor": 5
72+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import marimo
2+
3+
__generated_with = "0.13.0"
4+
app = marimo.App()
5+
6+
7+
@app.cell
8+
def _():
9+
data = [1, 2, 3]
10+
return (data,)
11+
12+
13+
@app.cell
14+
def _(data):
15+
summary = sum(data)
16+
print("Sum:", summary)
17+
return
18+
19+
20+
@app.cell
21+
def _():
22+
data_1 = [10, 20, 30]
23+
return
24+
25+
26+
@app.cell
27+
def _():
28+
return
29+
30+
31+
if __name__ == "__main__":
32+
app.run()

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ requires-python = ">=3.11"
77
dependencies = [
88
"marimo>=0.13.0",
99
"nbformat>=5.10.4",
10+
"pandas>=2.2.3",
1011
]

uv.lock

Lines changed: 134 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)