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

style.use('seaborn-talk')

krfont={'family':'Malgun Gothic', 'weight': 'bold', 'size' : 10}
matplotlib.rc('font', **krfont)
matplotlib.rcParams['axes.unicode_minus'] = False

%matplotlib inline

PCA

df_data = pd.read_excel('데이터 분석_예제.xlsm', sheet_name='주성분분석', usecols='A:N', nrows=20)
df_data.head()

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/6ea29c53-f611-4de5-aec2-4a996af7bd41/Untitled.png

sns.pairplot(data)

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/2663cb46-e480-4fc5-880d-6abc4cfe8f44/Untitled.png

plt.figure(figsize=(10,8))
sns.heatmap(data.corr(),annot=True)

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/93721cd0-59fa-46f5-8701-01bbcfe25d68/Untitled.png

#데이터 표준화
scale_data = (data - data.mean()) / data.std()
scale_data

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/06f4eb73-e270-4891-973d-24c25889baf2/Untitled.png