im a beginner in matplotlib. Im trying to plot a dataframe using matplotlib.pyplot. The problem is that everytime I try to plot it i get the following error:
ValueError: view limit minimum -35738.3640567 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.
According to the error, it seems to be like theres a non-datetime value in the datetime column, but there isnt.
Ive tried using pd.to_datetime() and try to change the format of the timestamp to pd.to_datetime(df_google['datetime'], format = '%d/%m/%Y')
but nothing changes.
This is the code im trying to use:
import matplotlib.pyplot as plt
df_google.plot()
plt.show()
df_google is a dataframe with columns ['datetime','price']
and some of the values are the following:
datetime price
0 2018-05-15 1079.229980
1 2018-05-16 1081.770020
2 2018-05-17 1078.589966
3 2018-05-18 1066.359985
4 2018-05-21 1079.579956
5 2018-05-22 1069.729980
6 2018-05-23 1079.689941
7 2018-05-24 1079.239990
8 2018-05-25 1075.660034
9 2018-05-29 1060.319946
Can someone try to help me understand this type of error? Why does it says theres a non-datetime value when every value is a datetime type value? How can I plot this dataframe?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…