Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Pythonで統計モデルをインポートするこれら2つのリストの相関関係を見つけるのを手伝ってくれませんか。
a=[1.0,2.0,3.0,2.0] b=[789.0,786.0,788.0,785.0]
いくつかの組み込み関数の使用
>>> import numpy as np >>> a = np.array([1.0,2.0,3.0,2.0]) >>> b = np.array([789.0,786.0,788.0,785.0]) >>> np.corrcoef(a,b) array([[ 1. , -0.2236068], [-0.2236068, 1. ]])
インデックスを使用して正しいものを抽出するだけです。
np.corrcoef(a,b)[0,1]