판다스의 plot() 메서드로 그래프를 그릴 수 있다. 아래는 kind 옵션들이다.
Jupyter Lab을 사용해야한다.
line : 선 그래프
bar : 수직 막대
barh : 수평 막대
his : 히스토그램
box : 박스 플롯
kde : 커널 밀도 그래프
area : 면적 그래프
pie : 파이 그래프
scatter : 산점도 그래프
hexbin : 고밀도 산점도 그래프
# %%
import pandas as pd
rel_path = "2020_summer_temp.xlsx"
abs_path = "C:\\Programming\\Pandas Study\\\\2020_summer_temp.xlsx"
df = pd.read_excel(abs_path, index_col=0)
df.columns = ["location", "average", "min", "max"]
df.rename_axis("date", inplace=True)
df = df.iloc[:, 1:]
df.plot()
# %%

# %%
import pandas as pd
rel_path = "2020_summer_temp.xlsx"
abs_path = "C:\\Programming\\Pandas Study\\\\2020_summer_temp.xlsx"
df = pd.read_excel(abs_path, index_col=0)
df.columns = ["location", "average", "min", "max"]
df.rename_axis("date", inplace=True)
df = df.iloc[:, 1:]
max_sr = df.max()
max_sr.plot(kind='bar')
# %%

# %%
import pandas as pd
rel_path = "2020_summer_temp.xlsx"
abs_path = "C:\\Programming\\Pandas Study\\\\2020_summer_temp.xlsx"
df = pd.read_excel(abs_path, index_col=0)
df.columns = ["location", "average", "min", "max"]
df.rename_axis("date", inplace=True)
df = df.iloc[:, 1:]
df.plot(kind='hist')
# %%

두 변수의 관계를 나타낼 때 사용된다.
어떤 변수를 비교할 것인지 선택해서 옵션을 통해 x, y축으로 정해줘야 한다.
# %%
import pandas as pd
rel_path = "2020_summer_temp.xlsx"
abs_path = "C:\\Programming\\Pandas Study\\\\2020_summer_temp.xlsx"
df = pd.read_excel(abs_path, index_col=0)
df.columns = ["location", "average", "min", "max"]
df.rename_axis("date", inplace=True)
df = df.iloc[:, 1:]
df.plot(**x='max', y='average'**, kind='scatter')
# %%