Published
Edited
Mar 31, 2021
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
// Danfo.js only accepts CSVs from the internet and has no methods for parsing local CSVs into DataFrames. If anyone knows a workaround, please comment!
// Right now, there are some hoops to jump if you want to upload a local file:
// (1) Fork this notebook and upload your file in the fork.
// (2) Publish the fork so that the file lives in Observable's server (ergo the internet) as opposed to just a blob URL that danfo won't accept. Now it has an URL that can be fed into danfo.read_csv().
// (3) Unpubish the fork and read in the file using the new, non-blob URL.

// Default URL: COMPAS dataset acquired by ProPublica. Refer to Northpointe-ProPublica controversy:
// * News article: https://www.propublica.org/article/machine-bias-risk-assessments-in-criminal-sentencing
// * Northpointe's response: https://www.equivant.com/response-to-propublica-demonstrating-accuracy-equity-and-predictive-parity/
// * ProPublica's rejoinder: https://www.propublica.org/article/propublica-responds-to-companys-critique-of-machine-bias-story
url = "https://raw.githubusercontent.com/DataResponsibly/RankingFacts/master/NotebookVersion/dataset/COMPAS_gender.csv"
Insert cell
// A column must have no more than this number of unique values to be categorical; otherwise it's continuous. Change this according to your data.
categoricalNumUniques = 10
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//import { fileInput } from "@mbostock/file-input"
Insert cell
/*viewof temp = csvInput({
initialUrl: url
})*/
Insert cell
/*function csvInput({ initialUrl, init, accept = ".csv" }) {
return fileInput({
initialUrl,
accept,
load(url) {
return dfd
.read_csv(url)
.then(df => df)
.catch(error => {
throw new Error(error);
});
}
});
}*/
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