수치형 데이터

수치형 데이터를 나타내는 가장 좋은 그래프는 산점도 혹은 선 그래프

산점도 그래프


sns.scatterplot(data=df , x='total_bill', y='tip', hue='day')
#-------------------------------------------------

sns.scatterplot(data=df , x='total_bill', y='tip', palette="ch:r=-.2,d=.3_r", hue='day')

선 그래프

#np.random.randn 함수는 표준 정규분포에서 난수를 생성하는 함수입니다. 
#cumsum()은 누적합을 구하는 함수입니다.
plt.plot(np.random.randn(50).cumsum())

x = np.linspace(0, 10, 100) 
plt.plot(x, np.sin(x), 'o')
plt.plot(x, np.cos(x)) 
plt.show()

sns.lineplot(x=x, y=np.sin(x))
sns.lineplot(x=x, y=np.cos(x))

스크린샷 2022-01-05 12.09.00.png

스크린샷 2022-01-05 12.09.11.png

sns.histplot(df['total_bill'], label = "total_bill")
sns.histplot(df['tip'], label = "tip").legend()# legend()를 이용하여 label을 표시해 줍니다.

#-------------------------------------
df['tip_pct'] = df['tip'] / df['total_bill']
df['tip_pct'].hist(bins=50)
#-------------------------------------

df['tip_pct'].plot(kind='kde')

스크린샷 2022-01-05 12.12.57.png

스크린샷 2022-01-05 12.13.08.png

스크린샷 2022-01-05 12.13.16.png