Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
hannari_20191206_goto.pdf
Search
namao510
December 06, 2019
Education
0
230
hannari_20191206_goto.pdf
namao510
December 06, 2019
Tweet
Share
Other Decks in Education
See All in Education
SUMMER SCHOOL 2024
pnuslide
0
140
UniKL 2024 - Phishing Security Awareness: Malware
x86fatah
0
110
Pen-based Interaction - Lecture 4 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
1.2k
Родина моя Беларусь в лицах
programmer_sch2np
0
150
2 занятие. Бизнес-модели и метод наблюдения PINT/SIRP #ideaNN 26.01.2024.
karlov
0
140
第33回 JAWS-UG札幌 クラウド女子会コラボ 勉強会
nagisa53
2
350
Tips for the Presentation - Lecture 2 - Advanced Topics in Big Data (4023256FNR)
signer
PRO
0
130
@ngrx/signals
yannickbaron
0
130
Multimodal Interaction - Lecture 3 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
1k
Analysis and Validation - Lecture 4 - Information Visualisation (4019538FNR)
signer
PRO
0
1.4k
Gesture-based Interaction - Lecture 8 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
1.2k
week2@tcue2024
nonxxxizm
0
740
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
175
21k
Designing for humans not robots
tammielis
247
25k
The Cost Of JavaScript in 2023
addyosmani
13
3.8k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
153
14k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
34
8.8k
GraphQLの誤解/rethinking-graphql
sonatard
49
9.2k
Atom: Resistance is Futile
akmur
258
25k
Scaling GitHub
holman
457
140k
Into the Great Unknown - MozCon
thekraken
10
980
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3k
Designing with Data
zakiwarfel
95
4.8k
Being A Developer After 40
akosma
56
580k
Transcript
みんなのはんなりPythonの会 2019/12/06 ~環境構築 & コード作成~ @namao
みんなのはんなりPythonの会 2019/12/06 自己紹介 @namao Python歴:2年弱 業務利用(データ分析) 興味のあるIT技術
(Python以外) Go, Linux(Debian),セキュリティなど 後輩などにPython指導する機会↗ connpass
みんなのはんなりPythonの会 2019/12/06 概要 私の指導経験 業務中での後輩指導 業務外での親友への指導(タダ!)
みんなのはんなりPythonの会 2019/12/06 概要 学習(つまずき)ポイント 環境構築 →AnacondaによるPython3.8環境構築 コードの書き方 →速いコード(pandas)作成
私の指導経験 業務中での後輩指導 業務外での親友への指導(タダ!)
みんなのはんなりPythonの会 2019/12/06
みんなのはんなりPythonの会 2019/12/06 コン パイ ル 不要 必要 イン ス トー
ル元 Anaconda独自 Python公式 Anaconda vs pip https://www.anaconda.com/understanding-conda-and-pip/ コンパイル: テキストからバイナリに変換 (初心者には難) 青字:メリット
みんなのはんなりPythonの会 2019/12/06 コン パイ ル 不要 必要 イン ス トー
ル元 Anaconda独自 Python公式 Anaconda vs pip https://www.anaconda.com/understanding-conda-and-pip/ 青字:メリット Windowsユーザーには、Anacondaがおすすめ!
みんなのはんなりPythonの会 2019/12/06 パッケージ情報を知る コマンド: conda search (パッケージ名) –c (チャンネル名)
*動作環境: cmd (windows) コンパイル情報 ・ ・ ・ Pythonのversion AnacondaのPython version対応状況を把握可
みんなのはんなりPythonの会 2019/12/06 仮想環境作成 仮想環境イメージ コマンド: conda create -n (仮想環境名)
python=(version番号) (パッケージ名) –c (チャンネル名) 実行例 *動作環境: cmd (windows)
みんなのはんなりPythonの会 2019/12/06 仮想環境作成 仮想環境イメージ コマンド: conda create -n (仮想環境名)
python=(version番号) (パッケージ名) –c (チャンネル名) 実行例 *動作環境: cmd (windows) 2コマンドで 環境構築可能
みんなのはんなりPythonの会 2019/12/06 Jupyter notebook エラー解消 (windows) asyncio.pyに上記コードを追加
みんなのはんなりPythonの会 2019/12/06 Python以外のパッケージ1 (R) https://anaconda.org/conda-forge/r-essentials Jupyter上でのR
みんなのはんなりPythonの会 2019/12/06 Python以外のパッケージ2 (git, git-bash) https://anaconda.org/anaconda/git Windowsでの bash(Linux)環境候補として Git-bashもおすすめ https://anaconda.org/conda-forge/git-bash
git git-bash
みんなのはんなりPythonの会 2019/12/06
みんなのはんなりPythonの会 2019/12/06 少休止(人もコードも?) 世間では・・・ 生産性向上 (スピード)
みんなのはんなりPythonの会 2019/12/06 少休止(人もコードも?) 世間では・・・ 生産性向上 (スピード) コードも同じ!
みんなのはんなりPythonの会 2019/12/06 速いコードの書き方(一般論) Python(スクリプト言語)の速さはコード行数に比例 forループを減らすことが基本 N=10**4 a=[] for
i in range(N): if i%3==0: a.append(i) N=10**4 a=[i for i in range(N) if i%3==0] ☓ ◯
みんなのはんなりPythonの会 2019/12/06 コードのスピード測定 (jupyter noebook) Jupyterでは%%timeitというマジックコマンドを使うのが簡単! https://ipython.readthedocs.io/en/stable/interactive/magics.html#cell-magics ☓ ◯
みんなのはんなりPythonの会 2019/12/06 処理のイメージ図 コードの速度比較(例1:ファイル結合) ☓ 10000 生徒一人の3教科の点数
みんなのはんなりPythonの会 2019/12/06 処理のイメージ図 コードの速度比較(例1:ファイル結合) ① ②
みんなのはんなりPythonの会 2019/12/06 処理のイメージ図 コードの速度比較(例1:ファイル結合) ① ②
みんなのはんなりPythonの会 2019/12/06 コードの速度比較(例2:行毎の合計) 10000人の学生それぞれの 3教科の合計点を算出 10000 Eng, Math, Japan sum
処理のイメージ図
みんなのはんなりPythonの会 2019/12/06 コード例 (10000人の3教科の合計) ① data.apply(sum,axis=1) ② data['Eng']+data['Math']+data['Japan’] ③ data.eval('Eng+Math+Japan’)
④ data.sum(axis=1) ⑤ pd.Series(data.values.sum(axis=1)) 10000 Eng, Math, Japan sum 処理のイメージ図 コードの速度比較(例2:行毎の合計)
みんなのはんなりPythonの会 2019/12/06 コード例 (10000人の3教科の合計) ① data.apply(sum,axis=1) ② data['Eng']+data['Math']+data['Japan’] ③ data.eval('Eng+Math+Japan’)
④ data.sum(axis=1) ⑤ pd.Series(data.values.sum(axis=1)) 速度結果 ①1160 ms,②2.58 ms,③9.96 ms,④2.05 ms,⑤1.14 ms 10000 Eng, Math, Japan sum 処理のイメージ図 コードの速度比較(例2:行毎の合計)
みんなのはんなりPythonの会 2019/12/06 本日のまとめ 環境構築 Anaconda活用方法(python3.8環境をコマンドで作成) Python以外のパッケージ(例: R, git)もインストール可
コードの書き方 速さを意識したコードを書くことは重要 スピード測定には、%%timeitが便利 (jupyter notebook)
みんなのはんなりPythonの会 2019/12/06
みんなのはんなりPythonの会 2019/12/06 まとめ アイデアを確認します。 上位の候補に投票して集約します。 要件と制限を確認します。
上位 5 から 10 のアイデアにリストの内容を調整します。