Published
Edited
Sep 15, 2020
1 fork
10 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
tweets = {
let tweets = [];

const text = await Files.text(file);
try {
// Twitter archive format starts with: `window.YTD.tweet.part0 = [ {`
tweets = JSON.parse(text.slice(25)).map(t => t.tweet);
} catch {
tweets = JSON.parse(text);
}

return tweets.map(t => {
t.retweet_count = +t.retweet_count;
t.favorite_count = +t.favorite_count;
t.created_at = new Date(t.created_at);
t.hour = t.created_at.getHours();
return t;
});
}
Insert cell
import {vl} from "@vega/vega-lite-api"
Insert cell
import {navio} from "@john-guerra/navio"
Insert cell
d3 = require("d3-dsv@2")
Insert cell
import { fileInput } from "@mbostock/file-input-with-initial-value"
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