Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Analysis of Julia usage in StackOverflow Developer Survey 2017
using Requests
using StatsBase
const URL = ""
const ZNAME = ""
const DNAME = "survey_results_public.csv"
function load()
isfile(DNAME) && return
if !isfile(ZNAME)
println("fetching data ...")
save(get(URL), ZNAME)
println("unzipping ...")
run(`unzip $ZNAME $DNAME`) # change to whatever unzip you have
cmap(lang, period) = countmap(vcat(filter(x-> lang in x, dss[:,period])...))
function pstats(period)
println("\n*** ", period == 1 ? "Used:" : "Wants to use:")
@printf("Julia: %.2f\n", 100mean(jdss[:, period]))
println("With Julia")
for l in jul[period][2:end]
println(" ", rpad(l.first,12), round(100l.second/jul[period][1].second))
println("From language:")
for b in both
cm = cmap(b, period)
println(" ", rpad(b,12), round(100cm["Julia"]/cm[b]))
ds = readcsv(DNAME)[2:end, 89:90]
dss = split.(ds, "; ")
jdss = in.("Julia", dss)
jul = [sort(collect(cmap("Julia", i)), lt=(a,b)->a[2]>b[2])[1:9] for i in 1:2]
both = sort(intersect(first.(jul[1][2:end]), first.(jul[2][2:end])))
foreach(pstats, 1:2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment