I am trying to extract data from MYSQL server and making a dataframe out of it.The SQL query I use is
sql="""SELECT dp.Date, dp.Open , dp.High, dp.Low, dp.Close, dp.Volume, dp.Adj FROM tickers AS tick INNER JOIN daily_price AS dp ON dp.ticker_id = tick.id WHERE tick.ticker = '%s' ORDER BY dp.Date ASC;"""%(ticker) goog = psql.frame_query(sql, con=con, index_col='Date')
This is working perfectly fine but when I use the function
obtain_df is just the function to get the
dataframe) and use
panda.series and not as
timeseries? I don't know the reason for this. In my SQL server also date is in the format 'DATE'.
Can you suggest how I convert the series to timeseries ?
da['Date']=pd.DatetimeIndex(da['Date']) da.set_index('Date') print da.head()
I get the following output
How do i make the date column as index.