Added some challenges to the HP analysis.
authorarokem <arokem@gmail.com>
Fri, 8 May 2015 00:50:46 +0000 (17:50 -0700)
committerAriel Rokem <arokem@gmail.com>
Fri, 8 May 2015 00:50:46 +0000 (17:50 -0700)
003-plot-timeseries.py
004-plot-histogram.py
load_hp_data.py

index ec9877607bae4108032e7bf60eb7bd78ea322fb8..f0fe2558b02bb016cec012cf993e8efceb5524a5 100644 (file)
@@ -23,11 +23,12 @@ ax.set_ylabel('Size of the edit')
 plt.show()
 
 
 plt.show()
 
 
-# Challenge: plot the relationship between edit size. Use 
+# Challenge: Is edit size related to how long it's been since the last edit? 
+# => Plot the relationship between edit size and the time since the last edit:
 
 
-## Hint 1: 
+## Hint 1: the number of seconds between two edits is: 
 
 
-#delta_time1 = hp.columns['timestamp'][1] - hp.columns['timestamp'][0]
+#delta_time1 = (hp.columns['timestamp'][1] - hp.columns['timestamp'][0]).total_seconds()
 
 ## Hint 2: 
 
 
 ## Hint 2: 
 
@@ -36,3 +37,9 @@ plt.show()
 
 # ax.plot([1,2,3], [2,4,8], '.')
 # ax.plot([1,2,3], [2,4,8], 'r.')
 
 # ax.plot([1,2,3], [2,4,8], '.')
 # ax.plot([1,2,3], [2,4,8], 'r.')
+
+# And see online documentation here: 
+# http://matplotlib.org/api/pyplot_summary.html
+# http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.plot
+
+
index 785a068f4bd1262185b3160ca55546ee8cea8343..b938feafb71aff44979dcb42299767effc5cb657 100644 (file)
@@ -18,5 +18,7 @@ ax.set_title('Edit size distribution')
 
 # Maybe don't really need that axis to be so long:
 # ax.set_xlim([0, 200000])
 
 # Maybe don't really need that axis to be so long:
 # ax.set_xlim([0, 200000])
-
 plt.show()
 plt.show()
+
+## Challenge : A 'mega-user' is a user with more than 1000 edits. 
+# Plot a bar chart with the maximal edit size for each one of the mega-users
index 0fe78c55c1186d76bf1fd0f2033eb84274654bbe..55d497c441a5c0e2260a241fe700115f5231f035 100644 (file)
@@ -22,7 +22,7 @@ for row in reader:
     row['size'] = int(row['size'])
     rows.append(row)
 
     row['size'] = int(row['size'])
     rows.append(row)
 
-# Sort these things, so that they give you nice time-series
+# Sort these things, so that they give you nice ordered time-series
 sort_rows = sorted(rows, key=lambda row: row['timestamp'], reverse=False)
 
 rows = sort_rows
 sort_rows = sorted(rows, key=lambda row: row['timestamp'], reverse=False)
 
 rows = sort_rows

Benjamin Mako Hill || Want to submit a patch?