python编写启发式算法--(1)
创造矩阵(多维数组)
Python numpy 提取矩阵的某一行或某一列
https://blog.csdn.net/luoganttcc/article/details/74080768
删除矩阵:https://www.jb51.net/article/139764.htm
numpy中的delete删除数组整行和整列的实例
1.删除一列
>>> dataset=[[1,2,3],[2,3,4],[4,5,6]] >>> import numpy as np >>> dataset = np.delete(dataset, -1, axis=1) >>> dataset array([[1, 2], [2, 3], [4, 5]])
2.删除多列
arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]]) np.delete(arr, [1,2], axis=1) array([[ 1, 4], [ 5, 8], [ 9, 12]])
删除列:
1.删除第i行和多行操作
x = numpy.delete(x,i, axis = 0)
矩阵中元素的定位:
Python扩展库numpy中where()函数的三种用法
https://blog.csdn.net/oh5W6HinUg43JvRhhB/article/details/80796594
dd0max=np.where(list_dd0==np.max(list_dd0)) #0最多的是哪一列