1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pythonをストレスなく使う!(Python Pocket Reference (O'REILLY)が、分かり易いっ)

Last updated at Posted at 2019-07-22

背景

Keras関連のpythonのコードで、
numpy配列の以下のような処理があり、

test_xxx_prediction[test_xxx_prediction >= 0.5] = 1

※test_xxx_predictionは、numpy配列

numpyの”fancy indexing”というようなものも、知らなかったので、
調査に手間取った。
泥縄式に調べる過程で、表題(下記)のPocket Referenceが、わかりやすいなと感じたので、、、
その旨、情報共有。(ただし、このリファレンスは、当然、numpy自体は範囲外です。)

 Python Pocket Reference, 5th Edition
 Python In Your Pocket
 By Mark Lutz
 Publisher: O'Reilly Media

( 出典:http://shop.oreilly.com/product/0636920028338.do )

cat.gif

目的

 pythonをストレスなく使う!
そのためには、少しでも、理解のレベルを上げる必要あり。
なんでも、こだわって、、、、理解を深める。
ここで記載しているのは、
Python Pocket Reference (O'REILLY)が、分かり易いっです。

Pocketなので、

  • 表が多用されており、
  • 網羅的
  • しかも、端的に整理されている。

”5th Edition”であり、人気があるのでは?

分かり易いっ例1

indexing,Slicingの説明。
以下、本項、すべて抜粋の形で引用。

Table3.Sequence operations (抜粋)

Operation Description Class method
S[i] Index by offset __getitem__
S[i:j],S[i:j:k] Slicing:items in S
from offset i through
j-1 by optional strike k
__getitem__

Sequence Operation Notes

Indexing:S[i]
・Fetches components at offsets(first item is at offset 0).
・.....

Slicing:S[i:j]
・Extracts contiguous sections of a sequence,from i through j-1
・...

分かり易いっ例2

listのcopyの説明が、スキがない。
単に、Make a copyでなく、**top-level(shallow)**の文言が
入っているのが、手短で、的確。

L.copy()
Make a top-level(shallow)copy of L. ...

まとめ

何度か、
Python Pocket Reference (O'REILLY)が、分かり易いっ
と感じたことがあるので、記事にした。

以前、
pythonをストレスなく使う!(結局docs.python.orgのreferenceが納得感が高い気が、、、)
と記載したが、
端的にまとまっているという意味では、
「Pocket Reference (O'REILLY)」が一番だと思う。

関連(本人)

pythonをストレスなく使う!(結局docs.python.orgのreferenceが納得感が高い気が、、、)
pythonをストレスなく使う!(generatorに詳しくなる。since1975らしい。)
pythonをストレスなく使う!(Pythonでは、すべてがオブジェクトとして実装されている)
pythonをストレスなく使う!(Pylintに寄り添う)
pythonをストレスなく使う!(ExpressionとStatement)
英語と日本語、両方使ってPythonを丁寧に学ぶ。

今後

コメントなどあれば、お願いします。:candy:
勉強します、、、、

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?