「NumPy」arange関数にdtypeを指定し配列を生成する

書式
numpy.arange(start, stop, step, dtype)
パラメーター
start: 開始数値を指定します
stop:終了数値を指定します。
step:数値の間隔(公差)を指定します。
dtype: 出力する配列のデータ型を指定します。
戻り値
等差数列の配列を返します。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
import numpy as np
res = np.arange(8, dtype = float)
print (res)
import numpy as np res = np.arange(8, dtype = float) print (res)
import numpy as np
 
res = np.arange(8, dtype =  float)  

print (res)

実行結果
[0. 1. 2. 3. 4. 5. 6. 7.]

NumPy

Posted by arkgame