Tweet time!

I’ve been using twitter for about five years, and I wondered if my use of it changed over time, and more precisely, linked to my wake/sleep cycle. That’s fortunately kind of simple to check because you can simply request your whole Twitter archive, delivered as a plain CSV File! Let’s see how we can juice it.

The following command will extract the date/time fields from the CSV file and remove the quotes:

cut -d, -f 4 < tweets.csv | grep \+ | sed s/\"//g  > times-UT.dat

Now, to get an interesting plot, I decided to use Mathematica, because it does nice graphics and because I did not know the Date/Time interface wasn’t all that fun to work with.

(* read date/time file *)
z = Flatten[
    String, RecordLists -> True], 1];

(* Translate date/time string into date and time objects *)
zz = Map[ {DateObject[#1[[1]]], TimeObject[#1[[2]]]} & , 
   StringSplit @ z];

(* arranged by year *)
t = Table[
   Select[zz, DateString[#1[[1]], "Year"] == ToString[i] &],
   {i, 2011, 2016}

(* by hour, corrected for GMT *)
h = Table[
   ToExpression @ 
    Map[DateString[#1, "Hour"] &, (t[[i]]\[Transpose])[[2]]],
   {i, Length[t]}
h = Mod[h + 19, 24]; (* correction GMT *)

Mathematica doesn’t seem to have a unified date/time object, and that complexifies the code a lot, with string to substring to date to string to integer conversion.

Now that we have the number of occurrence of every hours for six years, let’s see how my tweets are distributed.


It’s clear that from 2011 to 2012, I shifted my activities by about 4 hours. It does correspond to a carrier change, when it was more convenient to get out of bed much later. After that, the number of tweets vary, but not really their distribution over time, the peak being in the evening, after 20h00 (8h00 PM for those working in Liberty Units).


Also, over all, activity decreased a bit from 2013 to 2016, as not only the total number of tweets per year decreased, but also the “peak tweets”, falling from over 150 to about 100.

* *

Many people question the use of Twitter as a social media, but I think it does have its usefulness in sharing lost+found items, last minutes updates, and things like that; I do not think its format is propitious to creating large and tightly-knit communities.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: