plot - Seaborn tsplot windowed estimators -
i want tsplot estimator windowed function rolling mean rather mean. ideally i'd pass rolling mean function estimator
parameter of tsplot()
, individual timepoints passed estimator. so, looks i'm stuck pre-processing data.
is correct? there approach i'm overlooking here?
i don't think quite understand you're trying do, bootstrap function used in tsplot
compute confidence interval gets whole array , axis=0
, , resamples rows of array before reducing on operations. seems work:
import numpy np import pandas pd import seaborn sns import matplotlib.pyplot plt data = np.cumsum(np.random.randn(25, 40), axis=1) sns.tsplot(data=data)
def rolling_mean(data, axis=0): return pd.rolling_mean(data, 4, axis=1).mean(axis=axis) sns.tsplot(data=data, estimator=rolling_mean)
Comments
Post a Comment