(data)#列表生成一维数组
print(x)#打印数组
print(x.dtype)#打印数组元素的类型
data = [[1,2],[3,4],[5,6]]
x = numpy.array..._)#将字符串元素转换为数值元素
y = x.astype(numpy.int32)
x = numpy.array([ 1., 2.6,3. ],dtype = numpy.float32)#...九、NumPy的where函数使用:
# -*- coding:utf-8 -*-
# author:
import numpy
'''where函数的使用'''
cond = numpy.array... y2 = numpy.array([1,2,3,4])
x = numpy.where(cond>2,y1,y2) # 长度须匹配
print(x) # [1,2,-3,-4]
'''...where函数的嵌套使用'''
y1 = numpy.array([-1,-2,-3,-4,-5,-6])
y2 = numpy.array([1,2,3,4,5,6])
y3 = numpy.zeros