20160708 データ処理のプラットフォームとしてのpython 札幌
TRANSCRIPT
![Page 1: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/1.jpg)
Python
Sky
![Page 2: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/2.jpg)
![Page 3: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/3.jpg)
•
• Python 2000
(**)
• db tech showcase MongoDB
•
• FB: Ryuji Tamagawa
• Twitter : tamagawa_ryuji
![Page 4: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/4.jpg)
![Page 5: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/5.jpg)
2015
![Page 6: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/6.jpg)
2016
![Page 7: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/7.jpg)
• Python
• Python
![Page 8: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/8.jpg)
• Python
•
• Python
• NumPy, SciPy, matplotlib, Pandas • Python
• scikit-learn • TensorFlow
• Python IPython, Jupyter notebook, Spyder, VisualStudio
• Python
• Python
• Pandas
• Spark - PySpark DataFrame API
• matplotlib
![Page 9: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/9.jpg)
Part 1 : Python
![Page 10: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/10.jpg)
Python•
• GoogleGuido GoogleGoogle 1
•
NumPy, SciPy, matplotlib → Pandas
•
•
-2000Linux
-2010 Web Trac
![Page 11: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/11.jpg)
Python•
•
•
•
→
•
![Page 12: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/12.jpg)
Python
•
• pyODBC
• Web WSGI
![Page 13: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/13.jpg)
Python• 2.x 3.x 32bit 64bit
64bit
• 2.x
• 3.x3
• 2.x3.x
![Page 14: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/14.jpg)
• Ruby?
• R?
• Java?
• Scala?
![Page 15: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/15.jpg)
Python• Python ’CPython’ JIT
PyPy JVM Jython .Net IronPython
• CPython
• CPython 2
• C
• processingPySpark
![Page 16: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/16.jpg)
Python• Python
• 1 Linux Mac OS PythonPython Mac
• Python pip 3.x Python 2.7.9 2.xPython pip Linux Python
pip yum apt
• Python Anaconda Pythonconda
• python 2016 http://qiita.com/y__sama/items/5b62d31cb7e6ed50f02c
![Page 17: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/17.jpg)
NumPy, SciPy, matplotlib, Pandas•
• NumPy SciPy
• PandasPandas Pandas NumPy
• Anaconda Python
![Page 18: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/18.jpg)
Python•
scikit-learn http://scikit-learn.org/stable/
![Page 19: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/19.jpg)
Python• TensorFlow
Python
![Page 20: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/20.jpg)
Python
IPython
Jupyter, …
IDESpyder, Rodeo
Visual Studio, PyCharm, PyDev
![Page 21: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/21.jpg)
•
• GUI IDLE
•
OK
![Page 22: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/22.jpg)
• IPython
•
•
• Anaconda
• pip
![Page 23: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/23.jpg)
• Jupyter Notebook
• Python
• IPython NotebookPython
• Apache Zeppelin http://zeppelin.apache.org
![Page 24: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/24.jpg)
IDE
• R RStudio
• IDE
•
• 2 Spyder Rodeo
•
Spyder
![Page 25: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/25.jpg)
•
• Visual Studio
• Eclipse PyDev
• PyCharm
•
![Page 26: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/26.jpg)
Part 2 :
Python
![Page 27: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/27.jpg)
1 1.2 1000000L Python2
‘abc’ u’ ’ Python2
[1, 2, 3, ‘foo’, ‘bar’, ‘foo’]
(1, 2, 3, ‘foo’, ‘bar’, ‘foo’)
{‘k1’: ‘value1’, ‘k2’: ‘value2’}
set(1, 2, 3, ‘foo’, ‘bar’)
![Page 28: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/28.jpg)
•
•
• split
s = ‘foo, bar, baz’
items = s.split(‘,’)
print items[0]
print items[-1]
print items[0][-2:]
![Page 29: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/29.jpg)
• list comprehension
• dictionary comprehension
• lambda map, reduce, filter
sList = [‘foo’, ‘bar’, ‘baz’]
lList = [len(s) for s in sList]
lList = map(lambda s:len(s), sList)
lDict = {s:len(s) for s in sList}
![Page 30: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/30.jpg)
Pandas• Pandas
•
matplotlib / seaborn
• NumPySciPy
Python
• Pandas + matplotlibOK Pandas NumPy
NumPy / SciPy
![Page 31: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/31.jpg)
Pandas• Pandas
DataFrame
• R
• RDB2
• index Series Columns
Columns
Series Series SeriesIndex
![Page 32: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/32.jpg)
Pandas I/O• CSV JSON RDB Excel
• column
• RDB
•
import pandas as pd
pd.read_csv(<filename>)
pd.read_json(<filename>)
pd.to_csv(<filename>)
pd.to_excel(<filename>)
#
pd.to_clipboard()
![Page 33: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/33.jpg)
• http://sinhrks.hatenablog.com/entry/2015/01/28/073327
0 1
import pandas as pddf[‘nValue’] = df[‘value’] / sum(df[‘value’])
id value color
sapporo 43 red
osaka 42 pink
matsumoto 40 green
id value color nValue
sapporo 43 red 0.344
osaka 42 pink 0.336
matsumoto 40 green 0.32
Python
![Page 34: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/34.jpg)
Spark - PySpark DataFrame API
•
Python
• Spark PySparkfindSpark
Spark
• Python Spark APIDataFrame API
• Spark PandasSpark
PySpark
Sparknode
Sparknode
Sparknode
Sparknode
driver
![Page 35: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/35.jpg)
matplotlib / seaborn
•
• Python NumPy / Pandas
• Jupyter NotebookSpyder
![Page 36: 20160708 データ処理のプラットフォームとしてのpython 札幌](https://reader034.vdocuments.mx/reader034/viewer/2022050613/5a6ed61c7f8b9a9b2a8b50a3/html5/thumbnails/36.jpg)
Questions ?