Home > Blockchain >  Add trend line to datetime matplotlib line graph
Add trend line to datetime matplotlib line graph

Time:01-26

I have a pandas dataframe df:

times = pd.date_range(start="2018-09-09",end="2020-02-02")
values = np.random.rand(512)

# Make df
df = pd.DataFrame({'Time' : times, 
                   'Value': values})

And I can plot this easily using plt.plot:

plot1

But now I want to add a trendline. I tried using some answers:

enter image description here

  •  Tags:  
  • Related