I'm trying to do OLS with using a CSV file with dates on it. As it appears, it's not possible to use directly the date format to use as a predictor. I am trying to convert the 'Date' column to a datetime64[ns] but I get a
TypeError: invalid type promotion
error when calling the OLS method. Here's my code so far :
df = pd.read_csv('BOE-XUDLERD.csv', header=0)
df['Date'] = pd.to_datetime(df['Date'], format="%Y-%m-%d")
df['Date'] = df['Date'].astype('datetime64[ns]')
print(df['Date'])
est = sm.OLS(endog=df['Value'], exog=df['Date'], intercept=True)
I browsed many stackoverflow pages on how to get it right with dates, but I couldn't figure out how to use dates properly with OLS. If anyone has a clue ?
EDIT : data can be downloaded here : https://www.quandl.com/data/BOE/XUDLERD-Spot-exchange-rate-Euro-into-US