I'm working on a classification task(The dataset is 400,000 rows and 30 columns) and one of my features was date-time. I've extracted the month, day of the week, and hour from the dataset (year is a single value and I don't think minutes will have much influence). Since they're now categorical variables how do I deal with them? Should I leave them as a single row or use one-hot encoding or go for target encoding?

  • $\begingroup$ It quite depends on your problem. Making it One Hot is the best to avoid bias (each value will be independant from the others), but you can do many things with dates. If you have multiple dates, you can compare them etc. Many things others than just taking day, month, year can be done, depending on your original problem. $\endgroup$
    – Adept
    Mar 17, 2022 at 11:15
  • $\begingroup$ It has 1 date per each row in the dataset. So i guess comparing would not be possible? Is there a reference or an article you could provide on handling time feature in a dataset. I found some but most only focus on extracting things like day of week and month. $\endgroup$
    – insomniac
    Mar 19, 2022 at 3:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.