<aside> 💡 여기서는 산술적으로 익숙한 자료인 '2020년 여름 기온'으로 실습한다.

</aside>

mean() : 평균값

import pandas as pd

path = "2020_summer_temp.xlsx"
df = pd.read_excel(path, index_col=0)

print("< mean >")
print()
print(df.mean())
print()
print("평균기온 :", df["평균기온(℃)"].mean().__round__(2))
print(df[["최저기온(℃)", "최고기온(℃)"]].mean().__round__(2))
< mean >

지점        112.00
평균기온(℃)    23.63
최저기온(℃)    21.25
최고기온(℃)    26.70
dtype: float64

평균기온 : 23.63
최저기온(℃)   21.25
최고기온(℃)   26.70
dtype: float64

median() : 중간값

import pandas as pd

path = "2020_summer_temp.xlsx"
df = pd.read_excel(path, index_col=0)

print("< median >")
print()
print(df.median())
print()
print("평균기온 중간값 :", df["평균기온(℃)"].median().__round__(2))
print(df[["최저기온(℃)", "최고기온(℃)"]].median().__round__(2))
< median >

지점        112.00
평균기온(℃)    24.00
최저기온(℃)    21.30
최고기온(℃)    26.65
dtype: float64

평균기온 중간값 : 24.0
최저기온(℃)   21.30
최고기온(℃)   26.65
dtype: float64

max() : 최댓값

import pandas as pd

path = "2020_summer_temp.xlsx"
df = pd.read_excel(path, index_col=0)

print("< max >")
print()
print(df.max())
< max >

지점        112.00
평균기온(℃)    30.00
최저기온(℃)    27.00
최고기온(℃)    33.90
dtype: float64

min() : 최솟값

import pandas as pd

path = "2020_summer_temp.xlsx"
df = pd.read_excel(path, index_col=0)

print("< min >")
print()
print(df.min())
< min >

지점        112.00
평균기온(℃)    16.90
최저기온(℃)    13.90
최고기온(℃)    20.30
dtype: float64

std() : 표준편차

import pandas as pd

path = "2020_summer_temp.xlsx"
df = pd.read_excel(path, index_col=0)

print("< std >")
print()
print(df.std())
import pandas as pd

path = "2020_summer_temp.xlsx"
df = pd.read_excel(path, index_col=0)

print("< std >")
print()
print(df.std())

corr() : 상관계수