Public
Edited
May 17, 2022
Importers
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
rawGrid = FileAttachment("grille_densite_niveau_detaille_2022.xlsx").xlsx()
Insert cell
grid = aq.from(rawGrid.sheet(0, { headers: true }))
Insert cell
viewof gridClean = grid
.select(0,2)
.rename(aq.names('id', 'gridCat'))
.view()
Insert cell
Insert cell
rawAAV = FileAttachment("AAV2020_au_01-01-2022.xlsx").xlsx()
Insert cell
Insert cell
AAVlist = aq.from(rawAAV.sheet(0, { range: "A7:E706" }))
Insert cell
viewof AAVlistClean = AAVlist
.select(0,1,2)
.rename(aq.names('aav_id', 'aav_name', 'aav_size'))
.view()
Insert cell
Insert cell
AAVcom = aq.from(rawAAV.sheet(1, { range: "A7:G35000" }))
Insert cell
viewof AAVclean = AAVcom
.select(0,2,4)
.rename(aq.names('id', 'aav_id', 'aav_cat'))
.join_left(AAVlistClean, 'aav_id')
.filter(d => d.id != undefined)
.view()
Insert cell
AAVclean.groupby('aav_cat').count().view()
Insert cell
Insert cell
viewof zonages_insee = gridClean.join_left(AAVclean, 'id').view()
Insert cell
Insert cell
zonages_insee_parquet = parquet.writeParquet(zonages_insee.toArrowBuffer(),
new parquet.WriterPropertiesBuilder()
.setCompression(parquet.Compression.BROTLI)
.build()
)
Insert cell
Insert cell
Insert cell
test = {
// Import du fichier attaché
const parquetFile = await FileAttachment("zonages_insee@1.parquet")
// Lecture du fichier attaché au format binaire (arrayBuffer) + typage en Uint8Array
const parquetBytes = new Uint8Array(await parquetFile.arrayBuffer());
// Conversion au format Apache Arrow
const decodedArrowBytes = parquet.readParquet(parquetBytes);
// Conversion en table arquero
const arrowTable = aq.fromArrow(decodedArrowBytes);
return arrowTable
}
Insert cell
Insert cell
Insert cell
Insert cell
// Load the parquet-wasm library
parquet = {
const parquetModule = await import(
"https://unpkg.com/parquet-wasm@0.3.0/esm/arrow1.js"
);
// Need to await the default export first to initialize the WebAssembly code
await parquetModule.default();
return parquetModule;
}
Insert cell
Insert cell
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