๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
CODING/Python

[Python] ๋ฐ์ดํ„ฐ ๋ถ„์„ ์ž์ฃผ ์“ฐ๋Š” ์ฝ”๋“œ ๋ชจ์Œ (1) ํŒ๋‹ค์Šค, ๊ทธ๋ž˜ํ”„, ์ƒ๊ด€๊ณ„์ˆ˜

by ๋ฐํ†จ๋งนํ†จ 2022. 8. 14.
728x90
728x90

๐Ÿ”ด ํ•„์ˆ˜ ๋ชจ๋“ˆ 

# warning ์ œ๊ฑฐ
import warnings
warnings.filterwarnings('ignore')

# ๋ฐ์ดํ„ฐ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ
import pandas as pd
import numpy as np

# ๊ทธ๋ž˜ํ”„
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.express as px
import cufflinks as cf

# ๊ทธ๋ž˜ํ”„ ๊ธฐ๋ณธ ์„ค์ •
%matplotlib inline
plt.rc('font', family = 'Malgun Gothic')

 

๐Ÿ”ด ์ƒ๊ด€๊ณ„์ˆ˜ํ™•์ธ 

px.imshow(data.corr().round(2), text_auto = True,  color_continuous_scale='RdBu')

 

๐Ÿ”ด R2score ๋ฐ t_value ํ™•์ธ 

from statsmodels.api import OLS
import statsmodels.api as sm

model = OLS(y, x)
result = model.fit()

result.summary()
728x90

๋Œ“๊ธ€