Skip to content

Instantly share code, notes, and snippets.

@bkamins
Created June 27, 2017 20:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save bkamins/f6564d4c45ff4c9d2ad79b16872d50fc to your computer and use it in GitHub Desktop.
Analysis of Julia usage in StackOverflow Developer Survey 2017
using Requests
using StatsBase
const URL = "https://drive.google.com/uc?export=download&id=0B6ZlG_Eygdj-c1kzcmUxN05VUXM"
const ZNAME = "developer_survey_2017.zip"
const DNAME = "survey_results_public.csv"
function load()
isfile(DNAME) && return
if !isfile(ZNAME)
println("fetching data ...")
save(get(URL), ZNAME)
end
println("unzipping ...")
run(`unzip $ZNAME $DNAME`) # change to whatever unzip you have
end
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))
end
println("From language:")
for b in both
cm = cmap(b, period)
println(" ", rpad(b,12), round(100cm["Julia"]/cm[b]))
end
end
load()
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