[업무 지식]/Seaborn
[히스토그램] 한번에 시각화하는 함수 작성
에디터 윤슬
2024. 11. 27. 19:06
# 히스토그램 시각화
def get_hist(df):
import seaborn as sns
num_columns = len(df.columns)
rows = (num_columns // 5) + (num_columns % 5 > 0)
plt.figure(figsize=(20, rows * 5))
for i, column in enumerate(df.columns):
ax = plt.subplot(rows, 5, i + 1)
sns.histplot(df[column], kde=True)
plt.xlabel(column, fontsize=12)
plt.tight_layout()
plt.show()
get_hist(df)