python - matplot the plot is not showing the graph -


import csv import matplotlib.pyplot plt  path="e:\google stock market data - google_stock_data.csv.csv" file=open(path) reader=csv.reader(file) a=[] b=[] header=next(reader) data=[] row in reader:     data.append(row[:])     a=row[1]     b=row[2] plt.plot(a,b) plt.show() 

i tried csv using script above, when try plot it, shows following error:

file "c:\users\user\anaconda3\lib\site-packages\matplotlib\colors.py", line 204, in _to_rgba_no_colorcycle raise valueerror("rgba values should within 0-1 range")  valueerror: rgba values should within 0-1 range  <matplotlib.figure.figure @ 0x1b5e93b5ba8> 

what mean , how fix it?

you loop has like:

for row in reader:     data.append(row[:])     a.append(row[1]) # add element list use append     b.append(row[2]) plt.plot(a,b) plt.show() 

you have plot after filling lists a , b.

i recommend plot stock data candlestick here: https://stackoverflow.com/a/33068041/2666859


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -