Choosing the Right Aggregation Level for Temporal Data
We will now introduce how time is handled and how to extract time components from a datetime
object. Choosing the right aggregation level can be tricky and is worth exploring. A natural time aggregation, such as day or hour, may not be representative of the pattern. For example, an e-commerce website might have cyclical patterns on active users based on morning, afternoon, and evening. The aggregation level might not be present in the data and will need to be feature engineered in order to create new features. This is a common practice in the Machine Learning(ML) domain.
Now, let's do some hands-on exercises pertaining to date handling. We will use the AirPassengerDates.csv
dataset.
Example 1: Converting Date Columns to pandas DateTime Objects
We'll start by importing the necessary Python modules and read from the AirpassengersDates.csv
dataset using the following code:
#Import pandas library and read DataFrame...