Platform
Resources
Pricing
Sign in
Get started
University of Iowa
Workspace
Fork
Public
By
Gracedaisykoch
Edited
Feb 19
Fork of
Education Enrolment By County: Exercise 1
2
Insert cell
md
`# Education Enrolment By County: Exercise 2`
Insert cell
d3
=
require
(
"d3@5"
)
Insert cell
topojson
=
require
(
"topojson-client@3"
)
Insert cell
counties
=
FileAttachment
(
"County_ContUS_WGS1984.json"
)
.
json
(
)
Insert cell
counties_features
=
topojson
.
feature
(
counties
,
counties
.
objects
.
County_ContUS_WGS1984
)
Insert cell
csv_data
=
d3
.
csvParse
(
await
FileAttachment
(
"PopSchoolEnrollmentA1GV.csv"
)
.
text
(
)
,
(
{
ARWJE001
,
ARWJE002
,
ARWJE010
,
COUNTYA
}
)
=>
[
+
COUNTYA
,
[
100
*
+
ARWJE002
/
ARWJE001
,
100
*
+
ARWJE010
/
ARWJE001
]
]
)
Insert cell
//this is how to take the values of a variable (column) from all variables you created from the csv file
EnroldPct
=
Array
.
from
(
csv_data
.
values
(
)
,
d
=>
d
[
1
]
[
0
]
)
Insert cell
NotEnroldPct
=
Array
.
from
(
csv_data
.
values
(
)
,
d
=>
d
[
1
]
[
1
]
)
Insert cell
//this is how you map the id column to the values. We will use this for joining with topojson later.
data
=
Object
.
assign
(
new
Map
(
csv_data
)
,
{
title
:
[
"EnroldPct"
,
"NotEnroldPct"
]
}
)
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
d3
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
topojson
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
counties
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
counties_features
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
csv_data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
EnroldPct
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
NotEnroldPct
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML