Platform
Solutions
Resources
Pricing
Sign in
Sign up
Tom Février
Workspace
Fork
Published
By
Tom Février
Edited
Jul 16, 2020
1 fork
44 stars
1
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
kw
=
require
(
'https://bundle.run/kiwis@0.0.7'
)
Insert cell
Insert cell
Insert cell
h2g2Characters
=
kw
.
DataFrame
(
[
{
name
:
'Marvin'
,
surname
:
''
,
occupation
:
'Paranoid Android'
}
,
{
name
:
'Zaphod'
,
surname
:
'Beeblebrox'
,
occupation
:
'President of the Galaxy'
}
,
{
name
:
'Arthur'
,
surname
:
'Dent'
,
occupation
:
null
}
]
)
Insert cell
Insert cell
2
h2g2Characters
.
toString
(
)
Insert cell
Insert cell
h2g2Characters
.
columns
Insert cell
h2g2Characters
.
length
Insert cell
Insert cell
h2g2Characters
.
get
(
1
)
Insert cell
h2g2Characters
.
first
(
)
Insert cell
h2g2Characters
.
last
(
)
Insert cell
Insert cell
h2g2Characters
.
name
.
toString
(
)
Insert cell
Insert cell
h2g2Characters
.
toArray
(
)
Insert cell
Insert cell
Insert cell
Insert cell
3
Insert cell
oscars
=
kw
.
parseCSV
(
await
FileAttachment
(
'oscar_results@1.csv'
)
.
text
(
)
,
{
prettify
:
'camelCase'
}
)
Insert cell
oscars
.
toString
(
)
Insert cell
Insert cell
// Get the min and max values for the year
oscars
.
year
.
extent
(
)
Insert cell
// Get the average box office
oscars
.
boxOffice
.
mean
(
)
Insert cell
// Get the different categories
oscars
.
category
.
unique
(
)
Insert cell
// Get the 20 movies with the most nominations ("A Star Is Born" is cheating cause there are two of them!)
oscars
.
title
.
counts
(
)
.
slice
(
0
,
20
)
Insert cell
// Get the 20 movies with the most wins
oscars
.
filter
(
row
=>
row
.
winner
===
'true'
)
.
title
.
counts
(
)
.
slice
(
0
,
20
)
Insert cell
// Only show Sci-Fi movies that won an Oscar
oscars
.
filter
(
row
=>
row
.
genres
.
includes
(
'Sci-Fi'
)
&&
row
.
winner
===
'true'
)
.
toString
(
)
Insert cell
// Only show movies that won Best Picture and were the biggest commercial success of the year (1st at the box office)
oscars
.
filter
(
row
=>
row
.
category
===
'Best Picture'
&&
row
.
winner
===
'true'
&&
row
.
rank
===
1
)
.
toString
(
)
Insert cell
// Exclude 'Best Visual Effects' from the dataset and only keep a subset of the columns, renaming and reordering them
oscars
.
drop
(
row
=>
row
.
category
===
'Best Visual Effects'
)
.
filter
(
[
'year'
,
'title'
,
'category'
,
'winner'
]
)
.
rename
(
{
title
:
'name'
,
category
:
'award'
}
)
.
reorder
(
[
'name'
,
'year'
,
'award'
,
'winner'
]
)
.
toString
(
)
Insert cell
Insert cell
oscars
.
sort
(
[
'year'
,
'boxOffice'
]
)
.
toString
(
)
Insert cell
Insert cell
pivotTable
=
oscars
.
pivot
(
[
'category'
,
'year'
]
)
Insert cell
JSON
.
parse
(
pivotTable
.
toJSON
(
)
)
Insert cell
// Show the number of films nominated for each category and ceremony
pivotTable
.
count
(
)
.
toString
(
)
Insert cell
// Show the average box office of the nominees for each category and ceremony
pivotTable
.
mean
(
'boxOffice'
)
.
toString
(
)
Insert cell
// Show the winner for each category and ceremony, but remove the rows where the winner is missing
pivotTable
.
rollup
(
l
=>
{
const
winner
=
l
.
find
(
row
=>
row
.
winner
===
'true'
)
;
return
winner
?
winner
.
title
:
null
;
}
,
{
name
:
'winner'
}
)
.
dropNA
(
)
.
toString
(
)
Insert cell
Insert cell
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.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
kw
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
h2g2Characters
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Show 2 comments
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Show 3 comments
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
oscars
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
pivotTable
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML