Is the new Raspberry Pi AI Kit better than Google Coral?
135561 Views
Build Your Own AI Assistant Part 1 - Creating the Assistant
121827 Views
Control Arduino with Python using Firmata / PyFirmata
88872 Views
How to Map with LiDAR - using a Raspberry Pi Zero 2W, RPLidar and Rviz
65602 Views
Creating a Supercomputer with a Raspberry Pi 5 Cluster and Docker Swarm!
60799 Views
Node-Red Automation, MQTT, NodeMCU & MicroPython
53953 Views
How to Keep your Raspberry Pi happy
How to Install Pi-Apps on a Raspberry Pi
Pikon II, The Ultimate DIY Raspberry Pi Camera!
Pico Plotter
LEGO Gets Lights & Sound with Tiny FX
Thinkman
DuckDB - Fast, free analytics
1h 36m
Obsidian
1h 0m
Getting Started with C on the Raspberry Pi Pico
0h 50m
Running K3s on Raspberry Pi
1h 28m
From Docker to Podman
1h 2m
MicroPython Robotics Projects with the Raspberry Pi Pico
0h 54m
Learn how to Program in Python, C, Rust, and more.
Learn Linux from the basics to advanced topics.
Learn how to use a Raspberry Pi Pico
Learn MicroPython the best language for MicroControllers
Learn Docker, the leading containerization platform. Docker is used to build, ship, and run applications in a consistent and reliable manner, making it a popular choice for DevOps and cloud-native development.
Learn how to build SMARS robots, starting with the 3D Printing the model, Designing SMARS and Programming SMARS
Learn how to build robots, starting with the basics, then move on to learning Python and MicroPython for microcontrollers, finally learn how to make things with Fusion 360.
Learn Python, the most popular programming language in the world. Python is used in many different areas, including Web Development, Data Science, Machine Learning, Robotics and more.
Learn how to create robots in 3D, using Fusion 360 and FreeCAD. The models can be printed out using a 3d printer and then assembled into a physical robot.
Learn how to create Databases in Python, with SQLite3 and Redis.
KevsRobots Learning Platform
49% Percent Complete
By Kevin McAleer, 5 Minutes
DuckDB integrates tightly with Pandas and Polars. You can query DataFrames directly using SQL and get results back as DataFrames.
Seeing new terms (DataFrame registration, persistence, Parquet)? See the Beginner glossary.
Why this matters:
Useful for small scripts and notebooks when you don’t need persistence.
import duckdb, pandas as pd # Load a DataFrame url = 'https://raw.githubusercontent.com/mwaskom/seaborn-data/master/tips.csv' df = pd.read_csv(url) # Query a DataFrame directly (DuckDB auto-registers the variable name df) res = duckdb.query(""" SELECT day, time, ROUND(AVG(total_bill), 2) AS avg_bill FROM df GROUP BY day, time ORDER BY avg_bill DESC """).df() print(res.head())
You try it (2–3 min) Select only day, time, tip and compute tip_pct in SQL Filter to time = 'Dinner' and sort by tip_pct desc
You try it (2–3 min)
day, time, tip
tip_pct
time = 'Dinner'
Notes:
duckdb.query(..)
df
.df()
Use a connection when you want to create tables, run several queries, or reuse state across cells.
import duckdb con = duckdb.connect("analytics.duckdb") # creates the file if missing # Create or reuse a table from a remote CSV con.execute(""" CREATE TABLE IF NOT EXISTS tips AS SELECT * FROM read_csv_auto('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/tips.csv') """) # Run more queries using the same state out = con.execute("SELECT day, COUNT(*) AS orders FROM tips GROUP BY day ORDER BY orders DESC").df() print(out) con.close()
You try it (2–3 min) Add a view v_tips_enriched with tip_pct Create a table tip_summary(day, time, revenue, orders) from that view
v_tips_enriched
tip_summary(day, time, revenue, orders)
.duckdb
.execute()
When you have an in-memory DataFrame and want to join it with tables.
import duckdb, pandas as pd local_df = pd.DataFrame({ "day": ["Thur", "Fri", "Sat", "Sun"], "is_weekend": [False, False, True, True] }) con = duckdb.connect("analytics.duckdb") con.register("days", local_df) # now usable as table `days` res = con.execute(""" SELECT t.day, d.is_weekend, COUNT(*) AS orders FROM tips t JOIN days d ON d.day = t.day GROUP BY t.day, d.is_weekend ORDER BY orders DESC """).df() print(res) con.close()
You try it (2–3 min) Add avg_tip_pct using tip / NULLIF(total_bill,0) * 100 Sort by avg_tip_pct and compare weekend vs weekday
avg_tip_pct
tip / NULLIF(total_bill,0) * 100
register
.pl()
polars
# Optional: Polars # pip install polars import duckdb, polars as pl q = duckdb.query("SELECT 42 AS answer") res_pl: pl.DataFrame = q.pl() print(res_pl)
See also: Troubleshooting DuckDB for common Python/SSL/export issues.
Use ? placeholders and pass values as a list/tuple.
?
threshold = 20 rows = duckdb.query("SELECT * FROM tips WHERE total_bill > ?", [threshold]).df()
You try it (1–2 min) Bind a min_tip_pct variable and filter using tip / NULLIF(total_bill,0) * 100 > ?
You try it (1–2 min)
min_tip_pct
tip / NULLIF(total_bill,0) * 100 > ?
exports/
pip install polars
SSL on macOS (certificate verify failed): Run the Python certificate script once: bash "/Applications/Python 3.13/Install Certificates.command" Or in a venv: pip install certifi then export SSL_CERT_FILE="$(python -c 'import certifi; print(certifi.where())')" Alternative: let DuckDB fetch via httpfs: import duckdb con = duckdb.connect(); con.execute("INSTALL httpfs; LOAD httpfs;") df = con.execute("SELECT * FROM read_csv_auto('https://…/tips.csv')").df()
SSL on macOS (certificate verify failed):
bash "/Applications/Python 3.13/Install Certificates.command"
pip install certifi
export SSL_CERT_FILE="$(python -c 'import certifi; print(certifi.where())')"
import duckdb con = duckdb.connect(); con.execute("INSTALL httpfs; LOAD httpfs;") df = con.execute("SELECT * FROM read_csv_auto('https://…/tips.csv')").df()
< Previous Next >
You can use the arrows ← → on your keyboard to navigate between lessons.
← →