Twitter summary statistics
I have now used the Twitter 1000 times. In honor of this meaningless base-10 milestone, I have written a short python script to compute summary statistics on my timewasting. I release this into the public domain, in hopes that in time the blame is shared among us all.
You’ll need python twitter module and numpy.
import twitter import numpy import datetime username = 'egradman' password = 'xxx' api = twitter.Api(username=username, password=password) statuses = api.GetUserTimeline(username, count=999) average = numpy.average([len(s.GetText()) for s in statuses]) stddev = numpy.std([len(s.GetText()) for s in statuses]) stamps = [s.GetCreatedAtInSeconds() for s in statuses] stamps.reverse() diff = numpy.ediff1d(stamps) davg = numpy.average(diff) average_interval = datetime.datetime.fromtimestamp(davg) - datetime.datetime.fromtimestamp(0) longest_interval = datetime.datetime.fromtimestamp(max(diff)) - datetime.datetime.fromtimestamp(0) print "tweets:", len(statuses) print "average len:", average print "stddev len:", stddev print "average interval:", average_interval print "longest interval:", longest_interval
Eric Gradman is an interactive artist in Los Angeles, CA. His work often features computer vision, large-scale projections, unusual sensors, and custom electronics to produce fun environments that compel people to interact.