Created
April 16, 2016 16:31
-
-
Save Cartman0/cd39c1bfc88f5edccd8f4523fbd33b91 to your computer and use it in GitHub Desktop.
NumPy Tutorial メモ3 (Copies and Views)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"metadata": { | |
"toc": "true" | |
}, | |
"cell_type": "markdown", | |
"source": "# Table of Contents\n <p><div class=\"lev1\"><a href=\"#NumPyTutorial_3-1\"><span class=\"toc-item-num\">1 </span>NumPyTutorial_3</a></div><div class=\"lev2\"><a href=\"#Copies-and-Views(CopyとView)-1.1\"><span class=\"toc-item-num\">1.1 </span>Copies and Views(CopyとView)</a></div><div class=\"lev3\"><a href=\"#No-Copy-at-All(全くコピーを行わない)-1.1.1\"><span class=\"toc-item-num\">1.1.1 </span>No Copy at All(全くコピーを行わない)</a></div><div class=\"lev3\"><a href=\"#View-or-Shallow-Copy-1.1.2\"><span class=\"toc-item-num\">1.1.2 </span>View or Shallow Copy</a></div><div class=\"lev3\"><a href=\"#Deep-Copy-1.1.3\"><span class=\"toc-item-num\">1.1.3 </span>Deep Copy</a></div><div class=\"lev3\"><a href=\"#Functions-and-Methods-Overview-(関数とメソッドの概要)-1.1.4\"><span class=\"toc-item-num\">1.1.4 </span>Functions and Methods Overview (関数とメソッドの概要)</a></div><div class=\"lev4\"><a href=\"#Array-Creation(配列の作成)-1.1.4.1\"><span class=\"toc-item-num\">1.1.4.1 </span>Array Creation(配列の作成)</a></div><div class=\"lev4\"><a href=\"#Conversions(変換)-1.1.4.2\"><span class=\"toc-item-num\">1.1.4.2 </span>Conversions(変換)</a></div><div class=\"lev4\"><a href=\"#Manipulations(操作)-1.1.4.3\"><span class=\"toc-item-num\">1.1.4.3 </span>Manipulations(操作)</a></div><div class=\"lev4\"><a href=\"#Questions-1.1.4.4\"><span class=\"toc-item-num\">1.1.4.4 </span>Questions</a></div><div class=\"lev4\"><a href=\"#Ordering(順番)-1.1.4.5\"><span class=\"toc-item-num\">1.1.4.5 </span>Ordering(順番)</a></div><div class=\"lev4\"><a href=\"#Operations(演算)-1.1.4.6\"><span class=\"toc-item-num\">1.1.4.6 </span>Operations(演算)</a></div><div class=\"lev4\"><a href=\"#Basic-Statistics(基本統計)-1.1.4.7\"><span class=\"toc-item-num\">1.1.4.7 </span>Basic Statistics(基本統計)</a></div><div class=\"lev4\"><a href=\"#Basic-Linear-Algebra(基本的な線形代数)-1.1.4.8\"><span class=\"toc-item-num\">1.1.4.8 </span>Basic Linear Algebra(基本的な線形代数)</a></div><div class=\"lev2\"><a href=\"#参考リンク-1.2\"><span class=\"toc-item-num\">1.2 </span>参考リンク</a></div>" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "# NumPyTutorial_3" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "- [QuickStartTutorial](https://docs.scipy.org/doc/numpy-dev/user/quickstart.html)\n- [私訳「暫定的 NumPy チュートリアル」](http://naoyat.hatenablog.jp/entry/2011/12/29/021414)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "## Copies and Views(CopyとView)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "When operating and manipulating arrays,\ntheir data is sometimes copied into a new array and sometimes not. \n(配列の演算や操作のとき、それらのデータは、新しい配列にコピーされる時もあればそうでない時もある。)\n\nThis is often a source of confusion for beginners. \n(これは時として初心者にとって混乱の元となる。)\n\nThere are three cases(3ケースある):" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "### No Copy at All(全くコピーを行わない)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "Simple assignments make no copy of array objects or of their data.\n(シンプルな代入では、配列オブジェクトもそれらのデータもコピーされない。)" | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "import numpy as np", | |
"execution_count": 1, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "a = np.arange(12)\nb = a # no new object is create 新しいオブジェクトを作らない\nb is a # a and b are two names for the same ndarray object aとbは同じndarray objectを指す", | |
"execution_count": 2, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "True" | |
}, | |
"metadata": {}, | |
"execution_count": 2 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "b.shape = (3, 4) # changes the shape of a\na.shape", | |
"execution_count": 3, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "(3, 4)" | |
}, | |
"metadata": {}, | |
"execution_count": 3 | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "Python passes mutable objects as references, so function calls make no copy.\n(Python は、書き換え可能なオブジェクトを参照を渡すため、\n関数コールはコピーしない。)" | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": true | |
}, | |
"cell_type": "code", | |
"source": "def f(x):\n print(id(x))", | |
"execution_count": 4, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "id(a) # id is a unique identifier of an object(id はオブジェクトのユニークな識別子)", | |
"execution_count": 5, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "1864188480048" | |
}, | |
"metadata": {}, | |
"execution_count": 5 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "f(a)", | |
"execution_count": 6, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": "1864188480048\n", | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "### View or Shallow Copy" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "Different array objects can share the same data. \n(異なる配列オブジェクトが、同じデータを共有することができる。)\n\nThe `view` method creates a new array object that looks at the same data.\n(`view`メソッドは、同じデータに見える新しい配列オブジェクトを作成する。)" | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "c = a.view()\nc is a ", | |
"execution_count": 7, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "False" | |
}, | |
"metadata": {}, | |
"execution_count": 7 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "c.base is a # c is a view of the data owned by a (c は、a が所有しているデータのビュー)", | |
"execution_count": 8, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "True" | |
}, | |
"metadata": {}, | |
"execution_count": 8 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "c.flags.owndata", | |
"execution_count": 9, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "False" | |
}, | |
"metadata": {}, | |
"execution_count": 9 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "c.shape = (2, 6) # a's shape doesn't change\na.shape", | |
"execution_count": 10, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "(3, 4)" | |
}, | |
"metadata": {}, | |
"execution_count": 10 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "c[0, 4] = 1234 # a's data changes (a のデータは変更される)\na", | |
"execution_count": 11, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "array([[ 0, 1, 2, 3],\n [1234, 5, 6, 7],\n [ 8, 9, 10, 11]])" | |
}, | |
"metadata": {}, | |
"execution_count": 11 | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "Slicing an array returns a `view` of it\n(配列をスライスすると、その view が返される):" | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "s = a[ : , 1:3] # spaces added for clarity; could also be written \"s = a[:,1:3]\"\ns", | |
"execution_count": 12, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "array([[ 1, 2],\n [ 5, 6],\n [ 9, 10]])" | |
}, | |
"metadata": {}, | |
"execution_count": 12 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "s[:] = 10 # s[:] is a view of s. Note the difference between s=10 and s[:]=10 \ns #(s[:] はs のview。s=10 と s[:]=10 の違いに注意。)", | |
"execution_count": 13, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "array([[10, 10],\n [10, 10],\n [10, 10]])" | |
}, | |
"metadata": {}, | |
"execution_count": 13 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "a # aのデータも書き換わる", | |
"execution_count": 14, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "array([[ 0, 10, 10, 3],\n [1234, 10, 10, 7],\n [ 8, 10, 10, 11]])" | |
}, | |
"metadata": {}, | |
"execution_count": 14 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "test = [1,2,3,4,5]\ntest", | |
"execution_count": 15, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "[1, 2, 3, 4, 5]" | |
}, | |
"metadata": {}, | |
"execution_count": 15 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "_slice = test[1:4]\n_slice", | |
"execution_count": 16, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "[2, 3, 4]" | |
}, | |
"metadata": {}, | |
"execution_count": 16 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "_slice = [0,0,0]\n_slice", | |
"execution_count": 17, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "[0, 0, 0]" | |
}, | |
"metadata": {}, | |
"execution_count": 17 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "test # pythonのlist は、sliceしても別オブジェクト", | |
"execution_count": 18, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "[1, 2, 3, 4, 5]" | |
}, | |
"metadata": {}, | |
"execution_count": 18 | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "### Deep Copy" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "The `copy` method makes a complete copy of the array and its data.\n(copyメソッドは、配列とそのデータの完全なコピーを作る。)" | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "d = a.copy() # a new array object with new data is created(dは新たに作成されたデータを持つ新たな配列オブジェクト)\nd", | |
"execution_count": 19, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "array([[ 0, 10, 10, 3],\n [1234, 10, 10, 7],\n [ 8, 10, 10, 11]])" | |
}, | |
"metadata": {}, | |
"execution_count": 19 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "d is a", | |
"execution_count": 20, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "False" | |
}, | |
"metadata": {}, | |
"execution_count": 20 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "d.base is a # d doesn't share anything with a", | |
"execution_count": 21, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "False" | |
}, | |
"metadata": {}, | |
"execution_count": 21 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "d[0, 0] = 9999\nd", | |
"execution_count": 22, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "array([[9999, 10, 10, 3],\n [1234, 10, 10, 7],\n [ 8, 10, 10, 11]])" | |
}, | |
"metadata": {}, | |
"execution_count": 22 | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true, | |
"collapsed": false | |
}, | |
"cell_type": "code", | |
"source": "a", | |
"execution_count": 23, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": "array([[ 0, 10, 10, 3],\n [1234, 10, 10, 7],\n [ 8, 10, 10, 11]])" | |
}, | |
"metadata": {}, | |
"execution_count": 23 | |
} | |
] | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "### Functions and Methods Overview (関数とメソッドの概要)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "Here is a list of some useful NumPy functions and methods names ordered in categories. See Routines for the full list.\n(NumPy の関数およびメソッドのカテゴリ別一覧(name order)である。)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "#### Array Creation(配列の作成)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "- [arange](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.arange.html)\n- [array](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.array.html)\n- [copy (deep copy)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.copy.html)\n- [empty](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.empty.html)\n- [empty_like](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.empty_like.html#numpy.empty_like)\n- [eye (単位行列)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.eye.html)\n- [identity]()\n- [fromfile (ファイルからNumPy配列読み込み)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.fromfile.html)\n- [fromfunction](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.fromfunction.html)\n- [linspace](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.linspace.html)\n- [logspace](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.logspace.html)\n- [mgrid (多次元“meshgrid”を作る)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.mgrid.html)\n- [ogrid (1つの軸に長さをもった“meshgrid”を作る)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.ogrid.html)\n- [ones](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.ones.html)\n- [ones_like](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.ones_like.html#numpy.ones_like)\n- [r\\_](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.r_.html)\n- [zeros zero行列](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.zeros.html)\n- [zeros_like](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.zeros_like.html#numpy.zeros_like)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "#### Conversions(変換)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "- [ndarray.astype (型変換)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.ndarray.astype.html)\n- [atleast_1d (少なくとも1軸をもった配列に変換)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.atleast_1d.html)\n- [atleast_2d (少なくとも2軸をもった配列に変換)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.atleast_2d.html#numpy.atleast_2d)\n- [atleast_3d(少なくとも3軸をもった配列に変換)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.atleast_3d.html#numpy.atleast_3d)\n- [mat (matrix型)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.mat.html)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "#### Manipulations(操作)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "- [array_split](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.array_split.html)\n- [column_stack](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.column_stack.html)\n- [concatenate](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.concatenate.html)\n- [diagonal](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.diagonal.html)\n- [dsplit (第3軸に沿って分ける)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.dsplit.html)\n- [dstack (第3軸にスタック)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.dstack.html)\n- [hsplit](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.hsplit.html)\n- [hstack](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.hstack.html)\n- [ndarray.item (indexアクセス)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.ndarray.item.html) \n- [newaxis](https://docs.scipy.org/doc/numpy-dev/reference/arrays.indexing.html#numpy.newaxis)\n- [ravel](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.ravel.html)\n- [repeat](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.repeat.html)\n- [reshape](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.reshape.html)\n- [resize](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.resize.html)\n- [squeeze(single dimension を削除)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.squeeze.html)\n- [swapaxes(軸の交換)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.swapaxes.html)\n- [take](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.take.html)\n- [transpose(転置)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.transpose.html)\n- [vsplit](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.vsplit.html)\n- [vstack](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.vstack.html)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "#### Questions" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "- [all](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.all.html)\n- [any](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.any.html)\n- [nonzero (zeroでないindexを返す)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.nonzero.html)\n- [where](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.where.html)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "#### Ordering(順番)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "- [argmax](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.argmax.html)\n- [argmin](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.argmin.html)\n- [argsort (sort後のindexを返す)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.argsort.html)\n- [max](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.ndarray.max.html)\n- [min](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.ndarray.min.html)\n- [ptp (最小値から最大値の範囲を返す)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.ptp.html)\n- [searchsorted (ソート後のindexを返す)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.searchsorted.html)\n- [sort](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.sort.html)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "#### Operations(演算)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "- [choose](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.choose.html)\n- [compress](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.compress.html)\n- [cumprod (cumulative productを返す)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.cumprod.html)\n- [cumsum(cumulative sum を返す)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.cumsum.html)\n- [inner](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.inner.html)\n- [ndarray.fill](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.ndarray.fill.html)\n- [imag (虚数のみの演算)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.imag.html)\n- [real(実数のみの演算)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.real.html)\n- [prod (すべての要素の積した値を返す)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.prod.html)\n- [put(要素のreplace)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.put.html)\n- [putmask](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.putmask.html) \n- [sum](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.sum.html)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "#### Basic Statistics(基本統計)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "- [cov (共分散行列)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.cov.html)\n- [mean(平均)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.mean.html)\n- [std (標準偏差)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.std.html)\n- [var(分散)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.var.html)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "#### Basic Linear Algebra(基本的な線形代数)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "- [cross(クロス積)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.cross.html)\n- [dot(行列の積)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.dot.html)\n- [outer(直積)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.outer.html#numpy.outer)\n- [linalg.svd(特異値分解)](http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.linalg.svd.html)\n- [vdot(内積)](http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.vdot.html)" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "## 参考リンク" | |
}, | |
{ | |
"metadata": {}, | |
"cell_type": "markdown", | |
"source": "- [QuickStartTutorial](https://docs.scipy.org/doc/numpy-dev/user/quickstart.html)\n- [私訳「暫定的 NumPy チュートリアル」](http://naoyat.hatenablog.jp/entry/2011/12/29/021414)" | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3", | |
"language": "python" | |
}, | |
"language_info": { | |
"nbconvert_exporter": "python", | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"codemirror_mode": { | |
"version": 3, | |
"name": "ipython" | |
}, | |
"version": "3.5.1", | |
"name": "python", | |
"pygments_lexer": "ipython3" | |
}, | |
"toc": { | |
"toc_window_display": false, | |
"toc_threshold": "6", | |
"toc_cell": true, | |
"toc_number_sections": true | |
}, | |
"gist": { | |
"id": "", | |
"data": { | |
"description": "NumPy Tutorial メモ3 (Copies and Views)", | |
"public": true | |
} | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment