Last active
August 29, 2015 13:56
-
-
Save malmaud/9025047 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Pandas | |
using PyPlot | |
function to_df() | |
issues = deserialize(open("issues.jld")) | |
df = DataFrame(issues) | |
for datecol in ["closed_at", "created_at"] | |
df[datecol] = to_datetime(df[datecol]) | |
end | |
to_pickle(df, "issues.pickle") | |
df | |
end | |
to_inc(s) = Series(ones(length(s)), index=s) | |
function analyze_ts(df) | |
create = to_inc(df["created_at"]) | |
figure() | |
hold(true) | |
plot_by_week(create) | |
close = to_inc(dropna(df["closed_at"])) | |
plot_by_week(close) | |
legend(["Created", "Closed"]) | |
ylabel("# of issues") | |
xlabel("Time") | |
savefig("issues.pdf") | |
end | |
plot_by_week(s) = plot(resample(s, "1W", how="sum")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Requests | |
using JSON | |
auth_token = readall(open("auth_token.txt")) | |
N_issues = [645, 5179] | |
issues = {} | |
for (N_issue, state) in zip(N_issues, ["open", "closed"]) | |
n_requests = int(ceil(N_issue/100)) | |
for i=1:n_requests | |
@show i | |
s = string("https://api.github.com/repos/JuliaLang/Julia/issues?access_token=", auth_token, "&page=", i, "&per_page=100", "&state=", state) | |
local r | |
while true | |
try | |
r = get(s) | |
break | |
catch err | |
warn(err) | |
end | |
end | |
j = JSON.parse(r.data) | |
issues = [issues; j] | |
@show length(issues) | |
end | |
end | |
info("writing") | |
f=open("issues.jld","w") | |
serialize(f, issues) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment