Bitcoin Price project in Python for Finance course (19.2) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Bitcoin Price project in Python for Finance course (19.2)

Hi, I'm trying to get the same graph as expected in 19.2 but get the following error instead: ValueError: view limit minimum -36905.1 is less than 1 and is an invalid Matplotlib date value. This often happens if you pass a non-datetime value to an axis that has datetime units I wonder why is it so because the instance I'm trying to plot is a valid dataframe. My code is below: https://code.sololearn.com/crtXJX2qx9LK/?ref=app

8th Nov 2021, 10:43 AM
Tim
4 Answers
+ 4
I think I finally beat it, however my graph is not exactly the same as an example, looks like its Y axis is shorter for some reason. My code is: data = yf.Ticker('BTC-USD') x = data.history('1y')['Close'] start = 1000 / x[0] y = np.multiply(start, x) plt.plot(y) plt.savefig('plot.png')
8th Nov 2021, 1:13 PM
Tim
+ 3
This creates the exact same graph as shown in 19.2: data = yf.Ticker('BTC-USD') x = data.history(start='2020-10-12',end='2021-10-12')['Close'] start = 1000 / x[0] y = np.multiply(start, x) plt.plot(y) plt.savefig('plot.png')
23rd Apr 2022, 4:54 PM
Capital Age
Capital Age - avatar
+ 1
Thank you!
9th Nov 2021, 6:42 PM
Tim
0
I see your code is working when commented line 18 #plt.plot(years, values)
9th Nov 2021, 12:36 AM
Mahad Ahmed
Mahad Ahmed - avatar