Analyzing Joel stats


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # Enjoy Doing It Wrong, 2009.
  2. # License: WTFPL
  3.  
  4. import itertools
  5.  
  6. # found using stackoverflow.com/users
  7. bounds = [i*35 for i in (3307, 186, 93, 59, 41, 31, 23)] +\
  8. [19*35+20, 16*35+20, 13*35+20, 12*35+15, 6*35+4, 4*35-4] + [42, 8, 0]
  9.  
  10. # His stats
  11. joel_stats = [8, 10, 11, 11, 13, 14, 14, 15, 15, 16, 17, 19, 21, 26, 30]
  12. labels = [i for i in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50)]
  13.  
  14. gaps = []
  15. prev = bounds[0]
  16. for bound in bounds:
  17. gaps.append(prev-bound)
  18. prev = bound
  19.  
  20. less_than = gaps[1:-1]
  21.  
  22. def reputation_repartition(l):
  23. def careers_subscribers(l):
  24. return [n*s*.01 for n, s in itertools.izip(l, joel_stats)]
  25. subscribers = careers_subscribers(l)
  26. total = sum(subscribers)
  27. return [i/total*100 for i in subscribers]
  28.  
  29. reputation = reputation_repartition(less_than))
  30. data = [(str(rep), percent) for rep, percent in itertools.izip(labels, reputation)]
  31.  
  32. from pychart import *
  33. theme.output_file = "joel_raw.svg"
  34. theme.output_format = "svg"
  35. theme.use_color = True
  36. theme.reinitialize()
  37.  
  38. ar = area.T(x_axis=axis.X(label="Stack Overflow Reputation"),
  39. x_coord=category_coord.T(data, 0),
  40. y_range=(0, None),
  41. y_axis=axis.Y(label="Careers users (%)"))
  42. ar.add_plot(bar_plot.T(data=data, label="bleh"))
  43.  
  44. ar.draw()

URL: http://enjoydoingitwrong.wordpress.com/2009/12/14/joel-doing-it-wrong/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.