Skip to content

Instantly share code, notes, and snippets.

@malmaud
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malmaud/9025047 to your computer and use it in GitHub Desktop.
Save malmaud/9025047 to your computer and use it in GitHub Desktop.
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"))
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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