Skip to content

Instantly share code, notes, and snippets.

@smzn
Created January 6, 2024 08:42
Show Gist options
  • Save smzn/fdeacccb3f92582e37dfe4326d188e62 to your computer and use it in GitHub Desktop.
Save smzn/fdeacccb3f92582e37dfe4326d188e62 to your computer and use it in GitHub Desktop.
相関係数を計算
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# 列名のリスト
columns = ['Electric Bike Count', 'Classic Bike Count', 'Start Count', 'End Count', 'Member Count', 'Casual Count']
# 相関係数を計算
correlation_matrix = aggregated_data[columns].corr()
# ヒートマップの描画
plt.figure(figsize=(10, 8))
sns.heatmap(correlation_matrix, annot=True, cmap='coolwarm', fmt=".2f")
plt.title('Correlation Matrix Heatmap')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment