+ 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
4 Respuestas
+ 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')
+ 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')
+ 1
Thank you!
0
I see your code is working when commented line 18
#plt.plot(years, values)