0

I am using the yahoo_quote_download library to get some data from yahoo finance as either a pandas DataFrame or a csv file that I can then make into a DataFrame. However, when I use yqd.load_yahoo_quote(ticker, start_date, end_date), it returns a list like the following:

['Date,Open,High,Low,Close,Adj Close,Volume',
'2015-01-12,159.000000,159.250000,155.759995,156.440002,135.236679,4182800',
'2015-01-13,157.259995,159.970001,155.679993,156.809998,135.556564,4377500']

What I need, though, is a pandas DataFrame or a CSV file. Any help would be appreciated.

Dadep
  • 2,796
  • 5
  • 27
  • 40

1 Answers1

0

Try this:

mylist = ['Date,Open,High,Low,Close,Adj Close,Volume',
'2015-01-12,159.000000,159.250000,155.759995,156.440002,135.236679,4182800',
'2015-01-13,157.259995,159.970001,155.679993,156.809998,135.556564,4377500']

import pandas as pd
df = pd.DataFrame([i.split(',') for i in mylist[1:]], columns=list(mylist[0].split(',')))
df
Venkata Gogu
  • 1,021
  • 10
  • 25