Converting dates to appropriate form to train machine learning model


I am trying apply linear regression on a dataset where the independent variable is a date formatted like '2-jan-08'. How should I convert the date so it can be used for model fitting?


Posted 2019-01-28T02:26:19.110

Reputation: 1

Current question is too broad to be answered correctly. Post a part of your data or dummy data having a similar structure, to let others help you better. – Mankind_008 – 2019-01-29T19:11:41.080



It depends on whether the date is the single source of features data X or if the date is a feature of X, along with other features.

If the date is the only independent variable you have time-series models, such as the autoregressive (AR), integrated (I) or moving average (MA) models. Their combination results in the ARMA or in the ARIMA models. Check this tutorial on using ARIMA with Python

If the date is a feature among others, you can convert the original date into multiple date features. Check this thread for feature engineering with time data.


Posted 2019-01-28T02:26:19.110

Reputation: 406