Data Cleaning

Calculate Time Elapsed Between Two Date Values Using the Engine


So you have a data set that has date and time data and you don't know how to manipulate it?

There are many data wrangling operations that can be performed on date and time values to extract useful information for your machine learning models such as:

  • Calculate the time elapsed between two dates. The time could be in seconds, minutes, hours, days, weeks, months, or years.
  • Extract date and time attributes such as month, week, etc
  • Filter data based on date and time values

In this blog post, we will be focusing on the first point: calculating the difference in time between two dates.

The Data set

The data consists of two columns: Start Date and End Date. The date and time values are present in the following order: Year, Month, Day, Hour, Minute, Second. You can download the data set time_elapsed from here.

Step 1:

Once you upload the data set on the AI & Analytics Engine, you see the two columns: Start Date & End Date. The Engine leveraging AI automatically detects the two columns should be cast to Date-time type so you do just that.

difference between two dates in days

Step 2:

The next step is to use the built-in function in the Engine 'Compute Time Elapsed' to input the two columns whose difference you would like to calculate, give the output column a name, and the Engine would take care of the rest. The result would be in seconds but you can further manipulate it to convert it into hours, days, weeks, etc.

difference between two dates in days

Wrap-Up

There are many scenarios in which date-time values need to be manipulated and computing time elapsed between two date-time values is one of them. This can also be viewed as a feature extraction or feature engineering technique. The goal of this article is to help you understand how to use the AI & Analytics Engine to carry out this task using a built-in function. The Engine serves as a no-code machine learning platform for users without coding knowledge, so you don't get bogged down by menial tasks and instead focus on what matters the most: unleashing the hidden power of your data to improve decision making.

 

Have a dataset with date-time values, but not sure how to manipulate it? Try these steps above for yourself on the AI & Analytics Engine, with a 2-week free trial!

Free Trial

Similar posts