Chapter 4. Working with Time
When we were debating the content of this book, no chapter contained more examples than this one. We had so many examples about time that we added them in practically all chapters—including earlier ones.
What makes time interesting is that we can have a single column in our data related to time, and it makes our data extremely flexible to analyze. This is because time data is naturally hierarchical. Whether seconds, minutes, hours, days, weeks, months, quarters, or years, a column including time data gives you flexibility no other column of data will have.
In Chapter 3, we discussed categorical data. Categorical data is ideal for making comparisons. One underlying assumption about all comparisons is consistency. When we, the developers, visualize two non-time-based values, our audience assumes that we are making comparisons that are appropriate. Your audience probably assumes they are the same time period.
Imagine you are doing call-center analytics and are comparing total calls. If today is May 17, 2020, you probably wouldn’t want to compare total calls in 2019 to 2020 because they are two, much different lengths! Whether we are trying to compare year-to-date from the current year, or comparing one month’s performance to the same month a year ago, our audience assumes consistency with time periods—it’s practically an unspoken contract between the developer and the user.
The goal of this chapter is to discuss the natural hierarchy of dates and datetimes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access