I am trying to put mean as a trendline in the scatter plot
but looking at the documentation Linear and non-linear trendlines in Python, there is no trendline mean, any suggestion on how to do it?
import plotly.express as px
import pandas as pd
df = pd.DataFrame({βdateβ : [β01/01/2022β,β01/01/2022β,β01/01/2022β,β01/01/2022β,β01/01/2022β,β01/01/2022β,
β02/01/2022β,β02/01/2022β,β02/01/2022β,β02/01/2022β,
β03/01/2022β,β03/01/2022β,β03/01/2022β,β03/01/2022β],
βvalueβ: [12,15,5,9,22,27,12,16,6,2,18,16,17,19]})df[βdateβ] = pd.to_datetime(df[βdateβ])
fig = px.scatter(df, x=βdateβ, y=βvalueβ, trendline=βrollingβ, trendline_options=dict(window=df.value.count())
fig.show()
would something like rolling, window = y.count() make it?