Public
Edited
May 5, 2023
2 forks
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
rrhof@3.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
rrhof
select a. *
,case when gender_class='G1' THEN row_number () over (PARTITION BY class_year, gender_class)
else (row_number () over (PARTITION BY class_year, gender_class) * -1)+1 end as class_index
from(
select
label
,type
,gender
,class_year
,small
,category
,case when gender = 'male' then 'G1' else 'G2' end as gender_class
from rrhof
ORDER BY class_year, gender) a
Insert cell
Insert cell
rrhof
select
label
,type
,gender
,class_year
,small
,category
,case when label='Aretha Franklin' then 0
when label='Stevie Nicks' then 0 end as y1
,case when label='Aretha Franklin' then -5
when label='Stevie Nicks' then -5
when label = 'Gerry Goffin and Carole King' then -5
end as y2
from rrhof
where label IN ('Aretha Franklin', 'Stevie Nicks', 'Gerry Goffin and Carole King')
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more