I wrote this in response to Gurman's tweet. I remember answering in News Nerdery, but it was sadly lost to the void. :(
The CSV Swiss-army knife that trumps all others. Written in Rust, so it's absurdly fast in a way that's still kind of shocking.
{ | |
"01": "Alabama", | |
"02": "Alaska", | |
"04": "Arizona", | |
"05": "Arkansas", | |
"06": "California", | |
"08": "Colorado", | |
"09": "Connecticut", | |
"10": "Delaware", | |
"11": "District of Columbia", |
/** | |
* Original author: David Eads (https://github.com/eads) | |
* | |
* Wrap D3 charting components in a simple Backbone view interface | |
* | |
* Provides a redrawing path, data sync, and fallback for non-d3 browsers. | |
* | |
* Views that extend ChartView should implement their own "draw" function and go to work. | |
* | |
* var collection = new Backbone.Collection([ ["Maria", 33], ["Heather", 29] ]); |
/* Get site selection */ | |
var sites = document.getElementById('id_sites').querySelectorAll('option'); | |
selected_values = []; | |
for (var i=0; i<sites.length; i+=1) { | |
var site = sites[i]; | |
if (site.selected === true) { | |
selected_values.push(site.value); | |
} | |
} | |
console.log('[' + selected_values.toString() + ']'); |
FROM python:3.6-slim-stretch as csvbuilder | |
# This one uses csvs-to-sqlite to compile the DB, and then uses datasette | |
# inspect to generate inspect-data.json Compiling pandas takes way too long | |
# under alpine so we use slim-stretch for this one instead. | |
RUN apt-get update && apt-get install -y python3-dev gcc | |
COPY *.csv csvs/ | |
RUN pip install csvs-to-sqlite datasette | |
RUN csvs-to-sqlite csvs/names.csv data.db -f "name" -c "legislature" -c "country" |
I wrote this in response to Gurman's tweet. I remember answering in News Nerdery, but it was sadly lost to the void. :(
The CSV Swiss-army knife that trumps all others. Written in Rust, so it's absurdly fast in a way that's still kind of shocking.
I have an updated version of this on my blog here: https://chrisamico.com/blog/2023-01-14/python-setup/.
This is my recommended Python setup, as of Fall 2022. The Python landscape can be a confusing mess of overlapping tools that sometimes don't work well together. This is an effort to standardize our approach and environments.