Skip to content

Instantly share code, notes, and snippets.

@JoshAshby
Created May 3, 2011 04:46
Show Gist options
  • Save JoshAshby/952829 to your computer and use it in GitHub Desktop.
Save JoshAshby/952829 to your computer and use it in GitHub Desktop.
The Python bit:
m = len(query)
for i in range(m-1):
if (query[i]['quantity'] < query[i+1]['quantity']):
quantity.append(int(query[i]['quantity']))
date.append(time.mktime(query[i]['date'].timetuple()).as_integer_ratio()[0])
else:
break
Similar sort function in R:
for (i in 0:m) {
j = (m - i)
if (uy[(j)] > uy[(j-1)]) {
oy=matrix(uy[j:m], ncol=1)
ox=matrix(c(rep(1,(i+1)), ux[j:m,2]), ncol=2)
break
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment