From 0105566257b5ec0636bb83811bee8b70cc43c038 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 23 Dec 2025 17:22:53 +0000 Subject: [PATCH 1/4] Initial plan From bd1645e1c690dafc45b0bf917846fc291a83ea97 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 23 Dec 2025 17:28:13 +0000 Subject: [PATCH 2/4] Fix broken DuckDB example in documentation to use SQL query with con.query() Co-authored-by: ahuang11 <15331990+ahuang11@users.noreply.github.com> --- doc/index.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/index.md b/doc/index.md index f5607a2fe..33dfbf1fd 100644 --- a/doc/index.md +++ b/doc/index.md @@ -135,8 +135,19 @@ import duckdb import hvplot.duckdb from bokeh.sampledata.autompg import autompg_clean as df -df_duckdb = duckdb.from_df(df) -table = df_duckdb.groupby(['origin', 'mfr'])['mpg'].mean().sort_values().tail(5) +# Create a DuckDB connection and register the DataFrame +con = duckdb.connect(':memory:') +con.register('autompg', df) + +# Query using DuckDB SQL to aggregate and filter data +query = """ +SELECT origin, mfr, AVG(mpg) as mpg +FROM autompg +GROUP BY origin, mfr +ORDER BY mpg DESC +LIMIT 5 +""" +table = con.query(query) table.hvplot.barh('mfr', 'mpg', by='origin', stacked=True) ``` ```{image} ./_static/home/pandas.gif From 9439135a8b388c4c6e2cfdbfd512bd5dd1f235e6 Mon Sep 17 00:00:00 2001 From: Andrew <15331990+ahuang11@users.noreply.github.com> Date: Tue, 23 Dec 2025 10:24:58 -0800 Subject: [PATCH 3/4] Apply suggestions from code review --- doc/index.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/index.md b/doc/index.md index 33dfbf1fd..5ea26d093 100644 --- a/doc/index.md +++ b/doc/index.md @@ -135,11 +135,9 @@ import duckdb import hvplot.duckdb from bokeh.sampledata.autompg import autompg_clean as df -# Create a DuckDB connection and register the DataFrame con = duckdb.connect(':memory:') con.register('autompg', df) -# Query using DuckDB SQL to aggregate and filter data query = """ SELECT origin, mfr, AVG(mpg) as mpg FROM autompg From 45f22e905963a923284de4705968adc66652547e Mon Sep 17 00:00:00 2001 From: Andrew <15331990+ahuang11@users.noreply.github.com> Date: Fri, 26 Dec 2025 11:02:47 -0800 Subject: [PATCH 4/4] Update doc/index.md --- doc/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/index.md b/doc/index.md index 5ea26d093..a9763c788 100644 --- a/doc/index.md +++ b/doc/index.md @@ -145,7 +145,7 @@ GROUP BY origin, mfr ORDER BY mpg DESC LIMIT 5 """ -table = con.query(query) +table = con.query(query).sort("mpg") table.hvplot.barh('mfr', 'mpg', by='origin', stacked=True) ``` ```{image} ./_static/home/pandas.gif