Platform
Resources
Pricing
Sign in
Contact us
Hongtao Hao
Workspace
Fork
Public
By
Hongtao Hao
Edited
Dec 6, 2023
Fork of
Race by country
2
Insert cell
Insert cell
genderData
=
FileAttachment
(
"gender_by_country@1.csv"
)
.
csv
(
{
typed
:
true
}
)
Insert cell
countries
=
genderData
.
map
(
d
=>
d
.
country_full_name
)
Insert cell
uniqueCountries
=
[
...
new
Set
(
countries
)
]
;
Insert cell
viewof
cntry
=
Inputs
.
select
(
uniqueCountries
,
{
value
:
"United States"
,
label
:
"Choose country/region here"
}
)
Insert cell
filteredGenderData
=
genderData
.
filter
(
d
=>
d
.
country_full_name
===
cntry
)
Insert cell
genderplot
=
Plot
.
barY
(
filteredGenderData
,
{
x
:
"genderpred"
,
y
:
"freq"
,
fill
:
"steelblue"
}
)
.
plot
(
)
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
genderData
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
countries
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
uniqueCountries
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
cntry
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
filteredGenderData
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
genderplot
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML