リスト内のすべてのアイテム間のピアソン相関相関を計算しようとしています。data[0]とdata[1]、data[0]とdata[2]、data[1]とdata[2]の相関関係を取得しようとしています。
import scipy
from scipy import stats
data = [[1, 2, 4], [9, 5, 1], [8, 3, 3]]
def pearson(x, y):
series1 = data[x]
series2 = data[y]
if x != y:
return scipy.stats.pearsonr(series1, series2)
h = [pearson(x,y) for x,y in range(0, len(data))]
これにより、のエラーが返さTypeError: 'int' object is not iterable
れh
ます。誰かがここでエラーを説明できますか?ありがとう。