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?
1 Answer
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.