首页 > 编程知识 正文

arg是什么函数python,python中numpy用法

时间:2023-05-05 09:19:14 阅读:33903 作者:2182

numpy.argmin(Array,axis=None,out=None ) ) :返回特定轴上数组min元素的索引。

array:Input array to work on

axis :[int,可选] alongaspecifiedaxislike0or 1

out : [阵列可选] providesafeaturetoinsertoutputtotheout

arrayanditshouldbeofappropriateshapeanddtype

arrayofindicesintothearraywithsameshapeasarray.shape

withthedimensionalongaxisremoved。

# Python Program illustrating

# working of argmin ()

import numpy as geek

#工作在1d阵列上

array=geek.arange(8) )。

打印(输入阵列: (n ),阵列) )。

# returningindicesoftheminelement

# as per the indices

print ((nindicesofminelement : ),geek.argmin(Array,axis=0) ) ) ) ) ) ) )。

INPUT ARRAY:

索引of min element : 0

# Python Program illustarting

# working of argmin ()

import numpy as geek

#工作在2d阵列上

array=geek.random.randint(16,size=) 4,4 ) )

打印(输入阵列: (n ),阵列) )。

# returningindicesoftheminelement

# as per the indices

''''

0 2 4 0 - element

113 0索引

''''

print ((nindicesofminelement : ),geek.argmin(Array,axis=0) ) ) ) ) ) ) )。

INPUT ARRAY:

Indices of min element: [1 1 3 0]

# Python Program illustarting

# working of argmin ()

import numpy as geek

#工作在2d阵列上

array=geek.arange(10 ).reshape (2,5 ) )。

打印(阵列: (n ),阵列) )。

array[0][0]=10

阵列[1] [1]=1

阵列[0] [1]=1

打印((narray : (n ),array () ) ) ) )。

# Returns min element

print((NArray: )、geek.argmin ) (array ) ) ) ) ) ) ) 652

# firstoccurrenceofanminelementisgiven

print((nminelementindices: ),geek.argmin ) Array,axis=0) ) ) ) ) ) ) ) )。

array:

array:

array: 1

最小元素索引: [1000 ]

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。