Upgrade to Pro — share decks privately, control downloads, hide ads and more …

大人のためのPython入門in京都.pdf

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for kanan kanan
February 10, 2019

 大人のためのPython入門in京都.pdf

Avatar for kanan

kanan

February 10, 2019
Tweet

More Decks by kanan

Other Decks in Programming

Transcript

  1. ▪自己紹介▪ ▶ PyLadies Caravan STAFF ▶ PyLadies Tokyo は、参加者としてお邪魔してます。 ▶

    仕事はコンサルよりのデータ分析屋さん。 ▶ お酒が好き。昨日も京都の日本酒たのしみました。 かなん  @Addition_quince
  2. Pythonって、どんな言語? Python の起源 1991年 オランダ人のグイド・ヴァン・ロッサム氏によって開発されたプログラミング 言語。 名前の由来は、イギリスのテレビ局BCCが製作・放送した大ヒットコメディ番組であ る 「空飛ぶモンティ・パイソン」からきているとされる。  グイド・ヴァン・ロッサム (出典「wikipedia」) 

    6年以上前の1989年12月、私はクリスマス前後の週の暇つぶしのため「趣味」のプログ ラミングプロジェクトを探していた。オフィスは閉まっているが、自宅にはホームコン ピュータがあるし、他にすることがなかった。私は最近考えていた新しいスクリプト言語 のインタプリタを書くことにした。それは、ABCからの派生であり、Unix/Cハッカーの注 意をひきつけるかもしれないと考えた。ちょっとしたいたずら心から(『空飛ぶモンティ・パ イソン』の熱烈なファンだったというのも理由の1つ)、プロジェクトの仮称をPythonにし た。 — グイド・ヴァンロッサム、「Programming Python」の序文
  3. Python特徴①:シンプルな文法! Python の文法は本当にシンプルなのか? 2つの値(a, b)の最大公約数を求めるプログラムを Python, Java, Rubyの3つの言語で比較。 ※最大公約数を求めるアルゴリズムはユークリッドの互除法 を使用 

    def gcd(a, b): while b > 0: a, b = b, a % b return a def gcd(a, b) a, b = b, a if a > b until a == 0 a, b = b % a, a end return b end private static long getKoyakusu(long a, long b) { long candidate = a; while (b % a != 0) { candidate = b % a; b = a; a = candidate; } return candidate; } Java  Ruby  Python 
  4. Python特徴②:ライブラリが豊富! ライブラリとは、 多彩な計算やデータ加工を可能とする、モジュール(Pythonプログラ ム)群。 <例> ▶ datetime :日付時間処理 ▶ math

    :数学計算 ▶ numpy :行列演算 ▶ Pandas :データ加工 ▶ Matplotlib :グラフ描画 ▶ scikit-learn :機械学習 ▶ Chainer :深層学習
  5. Pythonの思想:The Zen of Python ▶ 1. Beautiful is better than

    ugly. ▶ 2. Explicit is better than implicit. ▶ 3. Simple is better than complex. ▶ 4. Complex is better than complicated. ▶ 5. Flat is better than nested. ▶ 6. Sparse is better than dense. ▶ 7. Readability counts. ▶ 8. Special cases aren't special enough to break the rules.
  6. Pythonの思想:The Zen of Python ▶ 9. Although practicality beats purity.

    ▶ 10. Errors should never pass silently. ▶ 11. Unless explicitly silenced. ▶ 12. In the face of ambiguity, refuse the temptation to guess. ▶ 13. There should be one-- and preferably only one --obvious way to do it. ▶ 14. Although that way may not be obvious at first unless you're Dutch.
  7. Pythonの思想:The Zen of Python ▶ 15. Now is better than

    never. ▶ 16. Although never is often better than *right* now. ▶ 17. If the implementation is hard to explain, it's a bad idea. ▶ 18. If the implementation is easy to explain, it may be a good idea. ▶ 19. Namespaces are one honking great idea -- let's do more of those!
  8. (参考)エディタ ▶ 実際にPythonでプログラムを書くときは、エディタと呼ばれるソ フトウェアを使うことが多い ▶ みんな自分の好みのエディタをメインで使っています。 ▶ Visual Studio Code (ビジュアルスタジオコード)

    ▶ PyCharm (パイチャーム) ▶ Atom (アトム) ▶ Notepad++ (ノートパッドプラスプラス) ▶ Sublime (サブライム) ▶ Jupyter Notebook (ジュピターノートブック)
  9. (参考)describe:要約統計量 count :件数 mean :平均 std :標準偏差 min :最小値 25%

    :25%点(第1四分位数) 50% :50%点(第2四分位数、中央値) 75% :75%点(第3四分位数) max :最大値
  10. (参考)パーセンタイル値 3kg 4kg 10kg 7kg 12kg 23kg 28kg 30kg 45kg

    体重 25%値 50%値 75%値 パーセンタイル値とは、データを昇順に並べた時の位置を表します。 ※百分位で位置を表す場合にパーセンタイル値となる。  データを昇順に並べ等分した時の位置を分位数(quantile)という。  よく使われるのは4等分する四分位数(quartile)である。 【四分位数】 25%値:全データの25%が入る値 第1四分位点(Q1) 50%値:全データの50%が入る値 第2四分位点(中央値)(Q2) 75%値:全データの75%が入る値 第3四分位点(Q3)
  11. (参考)箱ひげ図 Ω 25%の データ 25%の データ 25%の データ 25%の データ

    最大値 第3四分位 75%点 中央値 50%点 第1四分位 25%点 最小値