마약 관련 단속이 증가하고 있는가?

pandas로 경찰 활동 분석하기

Kevin Markham

Founder, Data School

가격 리샘플링

apple.groupby(apple.index.month).price.mean()
date_and_time
1    174.34
2    155.78
3    178.46
apple.price.resample('M').mean()
date_and_time
2018-01-31    174.34
2018-02-28    155.78
2018-03-31    178.46
pandas로 경찰 활동 분석하기

거래량 리샘플링

apple
date_and_time         price    volume          
2018-01-08 16:00:00  174.35  20567800
2018-01-09 16:00:00  174.33  21584000
2018-02-08 16:00:00  155.15  54390500
...                     ...       ...
apple.volume.resample('M').mean()
date_and_time
2018-01-31    21075900
2018-02-28    62531550
2018-03-31    27979650
Freq: M, Name: volume, Length: 3, dtype: float64
pandas로 경찰 활동 분석하기

가격과 거래량 연결

monthly_price = apple.price.resample('M').mean()
monthly_volume = apple.volume.resample('M').mean()
pd.concat([monthly_price, monthly_volume], axis='columns')
date_and_time   price    volume
2018-01-31     174.34  21075900
2018-02-28     155.78  62531550
2018-03-31     178.46  27979650
monthly = pd.concat([monthly_price, monthly_volume],
                     axis='columns')
pandas로 경찰 활동 분석하기

가격과 거래량 시각화 (1)

monthly.plot()
plt.show()

Apple 주식의 월간 평균 가격 및 거래량 단일 선 그래프

pandas로 경찰 활동 분석하기

가격과 거래량 시각화 (2)

monthly.plot(subplots=True)
plt.show()

Apple 주식의 월간 평균 가격 및 거래량 분리 선 그래프

pandas로 경찰 활동 분석하기

연습해 봅시다!

pandas로 경찰 활동 분석하기

Preparing Video For Download...