0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

どぁ

Posted at

import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt

データの読み込み(仮のデータフレーム名を df とします)

df = pd.read_csv('path_to_your_data.csv')

TDATE を datetime オブジェクトに変換

df['TDATE'] = pd.to_datetime(df['TDATE'], format='%Y%m')

相関行列の計算

correlation_matrix = df[['BPR', 'EST_SENTIMENT', 'EST_LIQUIDITY', 'INCM_NORM']].corr()

ヒートマップの作成

plt.figure(figsize=(10, 8))
sns.heatmap(correlation_matrix, annot=True, cmap='coolwarm', fmt=".2f")
plt.title('Correlation Matrix of Factors')
plt.show()

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?