20160708 データ処理のプラットフォームとしてのpython 札幌

36
Python Sky

Upload: ryuji-tamagawa

Post on 29-Jan-2018

2.156 views

Category:

Software


0 download

TRANSCRIPT

Page 1: 20160708 データ処理のプラットフォームとしてのpython 札幌

Python

Sky

Page 2: 20160708 データ処理のプラットフォームとしてのpython 札幌
Page 3: 20160708 データ処理のプラットフォームとしてのpython 札幌

• Python 2000

(**)

• db tech showcase MongoDB

• FB: Ryuji Tamagawa

• Twitter : tamagawa_ryuji

Page 4: 20160708 データ処理のプラットフォームとしてのpython 札幌
Page 5: 20160708 データ処理のプラットフォームとしてのpython 札幌

2015

Page 6: 20160708 データ処理のプラットフォームとしてのpython 札幌

2016

Page 7: 20160708 データ処理のプラットフォームとしてのpython 札幌

• Python

• Python

Page 8: 20160708 データ処理のプラットフォームとしてのpython 札幌

• 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 札幌

Part 1 : Python

Page 10: 20160708 データ処理のプラットフォームとしてのpython 札幌

Python•

• GoogleGuido GoogleGoogle 1

NumPy, SciPy, matplotlib → Pandas

-2000Linux

-2010 Web Trac

Google

Page 11: 20160708 データ処理のプラットフォームとしてのpython 札幌

Python•

Page 12: 20160708 データ処理のプラットフォームとしてのpython 札幌

Python

• pyODBC

• Web WSGI

Page 13: 20160708 データ処理のプラットフォームとしてのpython 札幌

Python• 2.x 3.x 32bit 64bit

64bit

• 2.x

• 3.x3

• 2.x3.x

Page 14: 20160708 データ処理のプラットフォームとしてのpython 札幌

• Ruby?

• R?

• Java?

• Scala?

Page 15: 20160708 データ処理のプラットフォームとしてのpython 札幌

Python• Python ’CPython’ JIT

PyPy JVM Jython .Net IronPython

• CPython

• CPython 2

• C

• processingPySpark

Page 16: 20160708 データ処理のプラットフォームとしてのpython 札幌

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 札幌

NumPy, SciPy, matplotlib, Pandas•

• NumPy SciPy

• PandasPandas Pandas NumPy

• Anaconda Python

Page 18: 20160708 データ処理のプラットフォームとしてのpython 札幌

Python•

scikit-learn http://scikit-learn.org/stable/

Page 19: 20160708 データ処理のプラットフォームとしてのpython 札幌

Python• TensorFlow

Python

Page 20: 20160708 データ処理のプラットフォームとしてのpython 札幌

Python

IPython

Jupyter, …

IDESpyder, Rodeo

Visual Studio, PyCharm, PyDev

Page 21: 20160708 データ処理のプラットフォームとしてのpython 札幌

• GUI IDLE

OK

Page 22: 20160708 データ処理のプラットフォームとしてのpython 札幌

• IPython

• Anaconda

• pip

Page 23: 20160708 データ処理のプラットフォームとしてのpython 札幌

• Jupyter Notebook

• Python

• IPython NotebookPython

• Apache Zeppelin http://zeppelin.apache.org

Page 24: 20160708 データ処理のプラットフォームとしてのpython 札幌

IDE

• R RStudio

• IDE

• 2 Spyder Rodeo

Spyder

Page 25: 20160708 データ処理のプラットフォームとしてのpython 札幌

• Visual Studio

• Eclipse PyDev

• PyCharm

Page 26: 20160708 データ処理のプラットフォームとしてのpython 札幌

Part 2 :

Python

Page 27: 20160708 データ処理のプラットフォームとしてのpython 札幌

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 札幌

• split

s = ‘foo, bar, baz’

items = s.split(‘,’)

print items[0]

print items[-1]

print items[0][-2:]

Page 29: 20160708 データ処理のプラットフォームとしてのpython 札幌

• 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 札幌

Pandas• Pandas

matplotlib / seaborn

• NumPySciPy

Python

• Pandas + matplotlibOK Pandas NumPy

NumPy / SciPy

Page 31: 20160708 データ処理のプラットフォームとしてのpython 札幌

Pandas• Pandas

DataFrame

• R

• RDB2

• index Series Columns

Columns

Series Series SeriesIndex

Page 32: 20160708 データ処理のプラットフォームとしてのpython 札幌

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 札幌

• 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 札幌

Spark - PySpark DataFrame API

Python

• Spark PySparkfindSpark

Spark

• Python Spark APIDataFrame API

• Spark PandasSpark

PySpark

Sparknode

Sparknode

Sparknode

Sparknode

driver

Page 35: 20160708 データ処理のプラットフォームとしてのpython 札幌

matplotlib / seaborn

• Python NumPy / Pandas

• Jupyter NotebookSpyder

Page 36: 20160708 データ処理のプラットフォームとしてのpython 札幌

Questions ?