Plotting error bars matplotlib, using pandas data frame

后端 未结 1 860
野趣味
野趣味 2021-02-08 14:57

I\'m sure this is relatively easy, but I can\'t seem to make it work. I would like to plot this df, with date as the x-axis, gas as the y-axis and std as errorbars using the mat

1条回答
  •  心在旅途
    2021-02-08 15:14

    std is a method on a dataframe, ex df.std().

    Use

    plt.errorbar(trip.index, trip['gas'], yerr=trip['std'])
    

    or if you have mpl1.5.0+

    plt.errorbar(trip.index, 'gas', yerr='std', data=trip)
    

    0 讨论(0)
提交回复
热议问题