Public
Edited
Jan 13, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
postsHashtags = data.map(d=>d[col].match(/#(\w+)/g)).filter(d=>d)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
timestamped = topHashtags.map(hashtag=>{
const postsIndexes = postsHashtags
.map((ph, index)=>({index: index,contains: ph.indexOf(hashtag)>-1}))
.filter(p=>p.contains)
.map(p=>p.index)

const dates = postsIndexes
.map(index=>{
const date = data[index].timestamp.split(" ")[0].split("/")
const [day, month, year] = date
const date_complete = `20${year}-${month}-${day}`
if (date_complete.length > 10) {
console.log(data[index])
}
return date_complete
})

const datesCount = d3.groups(dates.flat(), d => d)
.map(d=>({date:d[0],count:d[1].length}))
.map(d=>({hashtag:hashtag, ...d}))

return datesCount
}).flat()
Insert cell
Insert cell
forTable2Net = {
const ignored = ignoredList.split("\n")
return postsHashtags
.map(d=>{
const list = d.filter(dd=>ignored.indexOf(dd)===-1).filter(dd=>topHashtags.indexOf(dd)!==-1)
return {nodes:list.join(";"), links:list.join(";")}
})
.filter(d=>d.nodes!=="")
}
Insert cell
Insert cell
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