I am working with the following table
In the graphic I have drawn the line of values (blue) of the table and, in red color, I have set the average value of the column Visits made with a loop:
media = visitsPerDay['Visits'].mean()
mediaArr = []
for i in range(len(visitsPerDay)):
mediaArr.append(media)
plt.plot( visitsPerDay['Day'], visitsPerDay['Visits'], 'b-', visitsPerDay['Day'], mediaArr, 'r-')
Is it possible, just with the value of the average, to draw it as it appears in the graph? Or do I have to create an array necessarily?