# author: Roy.G
import numpy as np
# a=np.array([1,2,3,4,5,6])
# a.shape=(2,3)
# b=a>3
# print(b,type(a),a.shape)
# a=np.array([1,2,3])
# b=np.array([4,5,6])
# c=a*10
# print(c)
# a=np.array([[1,2,3,4,5],[6,7,8,9,0]])
# print(a.dtype)
# b=a.astype('float64')
# print(b,b.dtype) #修改数据类型
# print(b.size)
# print(b.shape)
# print(len(b)) #显示行数
# a=np.zeros((2,4),dtype='int32')
# print(a)
# b=1/5*np.ones((1,5),dtype='float32')
# print(b)
# c=np.ones_like(a)
# print(c)
# d=np.arange(1,10) #左闭右开
# print(d)
# ndarray的属性
# 数组的维度
# a=np.array([[1,2,3],
# [4,5,6]])
# print(a.shape,a.dtype)
# b=a.astype('float64')
# print(b.dtype)
#
# print(a.size) #返回元素的所有个数
# print(len(a)) #显示行数,即每列的长度
#索引
#三维数组
a=np.arange(1,19)
b=a.reshape(3,2,3)
# print(b)
# print('qiepian:',b[1,1])
# 遍历b中的元素
# for i in b:
# for j in i:
# for k in j:
# print(k) #这么写,似乎更消耗内存
# #这么写似乎更好
# for i in range(b.shape[0]):
# for j in range(b.shape[1]):
# for k in range(b.shape[2]):
# print(b[i,j,k])