LoginSignup
0
2

More than 1 year has passed since last update.

表の相関係数を一覧で見たいときはどうしたらいい?

Posted at

問題

一覧で相関係数を見たいときはどうしたらいい?
pythonのdataframeを使っている

解法

pandas.DataFrame.corr()をつかおう!

解答例

df_corr = df.corr()
print(df_corr)
print(type(df_corr))
#           A         B         C
# A  1.000000  0.958927  0.905882
# B  0.958927  1.000000  0.987130
# C  0.905882  0.987130  1.000000
# <class 'pandas.core.frame.DataFrame'>

参考文献

Coursera data analysis with python と
https://note.nkmk.me/python-pandas-corr/

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2