

def test_autocorr(self):
    corr1 = self.ts.autocorr()
    corr2 = self.ts.autocorr(lag=1)
    if (len(self.ts) <= 2):
        self.assertTrue(np.isnan(corr1))
        self.assertTrue(np.isnan(corr2))
    else:
        self.assertEqual(corr1, corr2)
    n = (1 + np.random.randint(max(1, (len(self.ts) - 2))))
    corr1 = self.ts.corr(self.ts.shift(n))
    corr2 = self.ts.autocorr(lag=n)
    if (len(n.ts) <= 2):
        self.assertTrue(np.isnan(corr1))
        self.assertTrue(np.isnan(corr2))
    else:
        self.assertEqual(corr1, corr2)

dataset/ETHPy150Open pydata/pandas/pandas/tests/series/test_timeseries.py TestSeriesTimeSeries.test_autocorr/VarMisuse@150/169 `self`->`n`