Mais conteúdo relacionado
Semelhante a Py "Baseball" Data入門 - 広島東洋カープ編 #pyconhiro (20)
Mais de Shinichi Nakagawa (20)
Py "Baseball" Data入門 - 広島東洋カープ編 #pyconhiro
- 3. Who am I?
• Shinichi Nakagawa(@shinyorke)
• Python , Hack ※ Python
• HR .
• Python/Agile/PyData/SABRmetrics( )
•
• ( ) .
- 4. • ( ) HR .
• 1 2
.
• (Django) Python .
• https://service.visasq.com
• https://tech.visasq.com
- 11. PyData
• , ,Python
&( ) .
• , or .
• Excel Python, Deep Learning,
etc… PyData
PyData ( )
- 15. •
• ( , ,FA)
• ( )
•
• ( , etc…)
• ( , J )
- 20. • ( - ) = 5 ( )
•
•
•
•
- 21. •
.
• ( - ) 5 5
(ry .
• = ( 2 )÷( 2 + 2 )
•
- 23. Python×pandas
# Python 3 (3.4 ) ( )
$ pip install ipython pandas beautifulsoup4 numpy lxml html5lib
# ipython ( Jupyter )
$ ipython
- 25. Python×pandas
#
# ( )
df_cl.columns = ['rank', 'name', 'games', 'win', 'lose', 'draw',
'pct', 'gb', 're_games', 'r', 'er', 'hr', 'sb', 'ba', 'era']
#
df_cl['win'] = df_cl['win'].fillna(0).astype(np.int64) #
df_cl['lose'] = df_cl['lose'].fillna(0).astype(np.int64) #
df_cl['pct'] = df_cl['pct'].fillna(0).astype(np.float64) #
df_cl['r'] = df_cl['r'].fillna(0).astype(np.int64) #
df_cl['er'] = df_cl['er'].fillna(0).astype(np.int64) #
- 26. Python×pandas
#
df_cl['difference'] = df_cl['r'] - df_cl['er']
#
df_cl['pythagorean_win_per'] = (df_cl['r'] ** 2) / (df_cl['r'] ** 2
+ df_cl['er'] ** 2)
#
df_cl['pythagorean_win'] = (df_cl['pythagorean_win_per'] *
143).fillna(0).astype(np.int64)
df_cl['pythagorean_lose'] = 143 - df_cl['pythagorean_win']
#
df_cl.sort_values(by='pythagorean_win_per', ascending=False)
- 50. [ ]
• ,
FIP, WHIP, K/BB, etc…
• ,
RC27 3 ( 6 )
•
- 51. Py "Baseball" Data - Python
※pandas, Re:dash (& )
MonotaRO TechTalk #4
http://www.kokuchpro.com/event/monotarotech4/