Series.autocorr(self, lag=1)
[source]
Compute the lag-N autocorrelation.
This method computes the Pearson correlation between the Series and its shifted self.
Parameters: |
|
---|---|
Returns: |
|
See also
Series.corr
Series.shift
DataFrame.corr
DataFrame.corrwith
If the Pearson correlation is not well defined return ‘NaN’.
>>> s = pd.Series([0.25, 0.5, 0.2, -0.05]) >>> s.autocorr() # doctest: +ELLIPSIS 0.10355... >>> s.autocorr(lag=2) # doctest: +ELLIPSIS -0.99999...
If the Pearson correlation is not well defined, then ‘NaN’ is returned.
>>> s = pd.Series([1, 0, 0, 0]) >>> s.autocorr() nan
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.Series.autocorr.html