plotting, debug | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

plotting, debug

import numpy as np import numpy_financial as npf import matplotlib.pyplot as plt #price for 2018-2021 year=[2018,2019,2020,2021] bitcoin = [3869.47,7188.46,22203.31,29391.78] pv=1000 coin= bitcoin[0]/pv newvalue= coin*bitcoin plt.plot(year,newvalue) plt.savefig("plot.png")

3rd Jan 2022, 6:34 AM
Debashish Das
Debashish Das - avatar
1 Answer
+ 5
Change line 9 From newvalue = coin*bitcoin To newvalue= np.asarray(coin)*bitcoin //Reason using the * operator on a list is the problem here so convert the list to numpy array
3rd Jan 2022, 6:40 AM
Shino
Shino - avatar