python 2.7 - ValueError: Shape of passed values is (6, 251), indices imply (6, 1) -


i getting error , i'm not sure how fix it. here code:

from matplotlib.finance import quotes_historical_yahoo_ochl datetime import date datetime import datetime import pandas pd  today = date.today() start = (today.year-1, today.month, today.day) quotes = quotes_historical_yahoo_ochl('axp', start, today) fields = ['date', 'open', 'close', 'high', 'low', 'volume'] list1 = [] in range(len(quotes)):     x = date.fromordinal(int(quotes[i][0]))     y = datetime.strftime(x, '%y-%m-%d') list1.append(y) quotesdf = pd.dataframe(quotes, index = list1, columns = fields) quotesdf = quotesdf.drop(['date'], axis = 1) print quotesdf 

enter image description here

how can change code achieve goal, change dateform , delete original one?

in principle code should work, need indent correctly, is, need append value of y list1 inside loop.

for in range(len(quotes)):     x = date.fromordinal(int(quotes[i][0]))     y = datetime.strftime(x, '%y-%m-%d')     list1.append(y) 

thereby list1 have many entries quotes instead of 1 (the last one). , final dataframe not complain misshaped data.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -