jupysql icon indicating copy to clipboard operation
jupysql copied to clipboard

pivot not showing results (duckdb)

Open edublancas opened this issue 2 years ago • 1 comments

from slack

image

edublancas avatar Nov 29 '23 20:11 edublancas

Data is from here

%%sql
CREATE TABLE Cities (Country VARCHAR, Name VARCHAR, Year INT, Population INT);
INSERT INTO Cities VALUES ('NL', 'Amsterdam', 2000, 1005);
INSERT INTO Cities VALUES ('NL', 'Amsterdam', 2010, 1065);
INSERT INTO Cities VALUES ('NL', 'Amsterdam', 2020, 1158);
INSERT INTO Cities VALUES ('US', 'Seattle', 2000, 564);
INSERT INTO Cities VALUES ('US', 'Seattle', 2010, 608);
INSERT INTO Cities VALUES ('US', 'Seattle', 2020, 738);
INSERT INTO Cities VALUES ('US', 'New York City', 2000, 8015);
INSERT INTO Cities VALUES ('US', 'New York City', 2010, 8175);
INSERT INTO Cities VALUES ('US', 'New York City', 2020, 8772);
%%sql
PIVOT Cities 
ON Year 
USING SUM(Population);

Should produce:

Country Name 2000 2010 2020
US Seattle 564 608 738
NL Amsterdam 1005 1065 1158
US New York City 8015 8175 8772

but only displays the column headings.

Tested again today using jupysql 0.10.16 and duckdb 1.1.3. Not sure if it ever worked with jupysql.

dmcmurchy avatar Dec 26 '24 18:12 dmcmurchy