Analyzing Timewarrior Data - Part 2
Today I discovered two Pandas tools for processing my Timewarrior data export into usable, day-by-day data.
The first is a dataframe method called explode
. As the Timewarrior “tags” column contains lists of all the tags used on a time entry, I ran df.explode("tags")
to split these up. If I had a time entry with ["cooking", "listening"]
in the tags
field, I would have two otherwise-identical time entries with "cooking"
and "listening"
in their tags
fields.
The second is pandas.to_datetime()
. It allowed me to run df["start"] = pd.to_datetime(df["start"])
to convert ISO UTC time strings in one column into Python datetime
formats.
The next step is to split overnight time entries in two so that time entries are in one day or another. This will allow accurate comparison of time spent on different days.