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?

  • $\begingroup$ 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. $\endgroup$ – Mankind_008 Jan 29 '19 at 19:11

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.