标签:bin auth 一个 help odi int numbers == nump
numpy.array[ ]
#!/usr/bin/python3 # -*- coding: utf-8 -*- # @Time : 18-10-17 上午10:51 # @Author : Guo Zhengbing # @Email : cn_gzb@126.com import numpy # print(help(numpy.genfromtxt)) a = numpy.array([5, 10, 25, 30]) b = numpy.array([[5, 1, 2], [23, 4, 9]]) # print(a) # print(b) # 输出矩阵 # print(a.shape) # 输出这个矩阵的类型 N行M列 # print(b.shape) # numbers = numpy.array([1, 2, 3, 4, ‘5‘]) # print(numbers) # print(numbers.dtype) # 输出类型 # 保证同一类型 # print(a[0:3]) # 矩阵切片 # print(b[:, 0]) # 取一个矩阵第1列 # print(b[:, 0: 2]) # 取一个矩阵前两列 matrix = numpy.array([ [5, 10, 15], [3, 6, 9], [8, 7, 13] ]) # print(matrix[1:3, 0:2]) # 取几行几列 a = numpy.array([5, 10, 25, 30]) # a == 10 # print(a == 10) # 判断数组中各个元素是否是10 # print(matrix == 10) # 判断数组中各个元素是否是10 # equal = (a == 10) # print(equal) # print(a[equal]) #返回真实值
标签:bin auth 一个 help odi int numbers == nump
原文地址:https://www.cnblogs.com/cn-gzb/p/9803193.html