Public
Edited
Jul 12, 2023
3 forks
Insert cell
Insert cell
Insert cell
viewof file = html`<input type=file accept="text/*">`
Insert cell
list = {
var dsv = d3.dsvFormat(format);
const text = await Files.text(file)
let data = dsv.parse(text)
return data
}
Insert cell
Insert cell
hashes = list.map(d=>d[col].match(/#(\w+)/g)).filter(d=>d)
Insert cell
allHashes = hashes.flat()
Insert cell
stats = d3.groups(allHashes, d => d).map(d=>({tag:d[0],count:d[1].length})).sort((a,b)=>b.count-a.count)
Insert cell
topsss = stats.slice(0,5000).map(d=>d.tag)
Insert cell
hashesTopsss = hashes.map((d,i)=>{
if (d && d.length>0) {
return d.filter(dd=>topsss.indexOf(dd)>-1)
}
})
Insert cell
forTabel2Net = hashesTopsss.filter(d=>d).map((d,i)=>({hashtags:d.join(";"),"links":d.join(";"),"date":list[i]["Creation Date"].split(" ")[0]}))
Insert cell
Insert cell
import {select, text, radio, checkbox} from "@jashkenas/inputs"
Insert cell
d3 = require("d3@v6")
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