Datetime issue with matplotlib

前端 未结 5 1108
离开以前
离开以前 2021-01-18 02:09

I\'m pulling my hair to display a series with matplotlib.

I\'m working with python 2.7. I have a pandas Dataframe with dates. I converted dates to datetime and I\'m

5条回答
  •  星月不相逢
    2021-01-18 02:47

    As others could not reproduce this ValueError, my guess is that you transformed df2bis to a pandas.Series somewhere and tried to plot the Series, that would throw:

    ValueError: view limit minimum 0.0 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
    

    To fix this, try

    pd.DataFrame(df2bis).plot()
    

    Good luck!

提交回复
热议问题