Public
Edited
Sep 30, 2023
Insert cell
Insert cell
Insert cell
df = FileAttachment("demografia.xlsx").xlsx()
Insert cell
Insert cell
data_df = df.sheet(0, {headers: true})
Insert cell
Insert cell
data_df.slice(0,5)
Insert cell
Insert cell
data_df.columns
Insert cell
Insert cell
a = data_df.filter( (d)=> d["1960"] < 4500)
Insert cell
Insert cell
data_df1= data_df.map((d) => d['CountryNameRu'] = d['CountryNameRu'].toUpperCase())
Insert cell
Insert cell
viewof table = Inputs.table(data_df)
Insert cell

viewof select = Inputs.select(stateNames, {label: "Year"} )


Insert cell
Insert cell
Plot.plot({
width:1000,
height:2000,
marks: [
Plot.barX(data_df.filter(d => d[select] < 100000000), {y: "CountryNameRu", x: select, fill:"#7B68EE", sort: {y: "x", reverse: false} }),
Plot.ruleX([0, 10000000, 20000000, 30000000, 40000000, 50000000, 60000000, 70000000, 80000000, 90000000, 100000000], {fill:"#aaaaaa"})],
color: { legend: true },
marginLeft: 225,
})
Insert cell
stateNames = new Set(data_df.columns.slice(2,-2))
Insert cell
viewof rows = Inputs.table(data_df, {typed: true})
Insert cell
viewof select4 = Inputs.select(stateNames4, {label: "Year"} )
Insert cell
Plot.plot({
width:1500,
height:500,
marks: [
Plot.ruleX([0]),
Plot.lineX(data_df.filter(d => d[select4] < 100000000), {x: "CountryNameRu", y: select4, sort: {y: "x", reverse: false} }),
]
})
Insert cell
stateNames4 = new Set(data_df.columns.slice(2,-2))
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.
Learn more