ํ์ผ ์ฝ์ด์ค๊ธฐ
pd.read_csv(โํ์ผ ๊ฒฝ๋กโ, โindexโ, parse_dates= True)
- index๋ index_col = โDateโ ์ด์ฉ
- parse_dates=True โ ์ผ๋ฐ date ์ธ๋ฑ์ค๋ฅผ DatetimeIndex๋ก ์ ํ
๊ทธ๋ํ ๊ทธ๋ฆฌ๊ธฐ
df.plot.hist(bins
, edgecolor
).autoscale(enable
,axis
, tight
)
- histogram
- bins : ๊ทธ๋ํ ๊ตฌ๊ฐ์ ๋ช๊ฐ๋ก ๋๋ ๊ฒ์ธ์ง (int)
- edgecolor: ํ
๋๋ฆฌ ์๊น (char)
- axis: x์ถ, y์ถ scaling (x, y, both)
- tight: ๊ทธ๋ํ๋ฅผ ์ ์ฒด ํฌ๊ธฐ์ ๋ง์ถ ๊ฒ์ธ์ง (True, False)
df.plot.bar(stacked
)
- bar chart
- stacked: ๊ฐ์ ๋์ ํ ๊ฒ์ธ์ง (True, False)
- df.plot.barh : ๊ฐ๋ก ๋ง๋ ๊ทธ๋
df.plot.area()
- area chart (๋์ ์ฐจํธ)
df.plot.box()
df.plot.pie()
df.plot.line(figsize
, ls
, c
, lw
)
- figsize: ๊ทธ๋ํ ์ฌ์ด์ฆ
- ls: ์ ๋ชจ์
- c: ๊ทธ๋ํ ์
- lw: ์ ๊ตต๊ธฐ
๊ทธ๋ํ ์ค์
.set(xlabel, ylabel)
.legend(loc, bbox_to_anchor=())
Ex)
ax = df['Close'].plot(figsize=(12,6), title='Title')
ax.autoscale(axis='x', tight = True)
ax.set(xlabel='Xlabel', ylabel='Ylabel')

df['Close']['2017-01-01':'2017-12-31'].plot()

์ฐธ๊ณ ์๋ฃ
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.plot.html
https://colab.research.google.com/drive/14bYRPSSa6R2AsrX-07_3MOJHCsqLKst1#scrollTo=E4PGEF4cO2hH
01-Customizing-Plots.ipynb