注:使用的编译器 jupter notebook
python基本库:numpy , pandas 数据分析+人工智能基础
sklearn 数据挖掘+人工智能基础
tensorflow 深度学习框架
可视化工具:Matplotlib ,seaborn ,excel ,Tableau ,POWERBI ,SPSS
Numpy ndarray对象
Numpy定义了一个n维数组对象,简称ndarray对象,是一个一系列相同类型元素组成的数组集合,数组中的每个元素都占有大小相同的内存块。
ndarray对象采用了数组的索引机制,将数组中的每个元素映射到内存块上,并且按照一定的布局对内存块进行排列。
ndarray对象属性:
ndarray.ndim 秩,轴的数量或维度的数量
ndarray.shape 数组的维度,对于矩阵(a,b)
ndarray.size 数组元素的总个数,相当于.shape中a*b的值
ndarray.dtype ndarray对象的元素类型
ndarray.itemsize ndarray对象中每个元素的大小,以字节为单位
numpy创建数组
numpy.array(object,dtype=None,copy=True,order=None,subok=False,ndmin=0)
object 表示一个数组序列(列表,元组,数组,迭代对象等。。。强制转化为数组类型)
dtype 更改数组的数据类型
copy 表示数组能否被复制,默认为True (当复制a的复件b的copy属性为false时,a和b两个变量会指向相同的内容地址,修改b时,a会发生变化)
order 与内存布局有关(可以不深究)
ndmin 指定数组维度
subok 是否保持使用数组的数据类型,默认为False
arange()生成区间数组
numpy.arange(start,stop,step,dtype)
start 起始值,默认为0
stop 终止值
step 步长,默认为1
dtype 返回ndarray的数据类型
linspace()创建等差数列
np.linspace(start,stop,num=50,endpoint=True,retstep=False,dtype=None)
start 起始值
stop 终止值
num 要生成的等长的样本数量,默认为50
endpoint 数列中是否包含stop值
retstep 生成的数组中是否显示间距
dtype 返回ndarray的数据类型
logspace()创建等比数列
np.logspace(start,stop,num=50,endpoint=True,base=10.0,dtype=None)
start 起始值
stop 终止值
num 要生成的等比的样本数量,默认为50
endpoint 数列中是否包含stop值
base 对数log的底数
dtype 返回ndarray的数据类型
全0数列,全1数列
numpy.zeros(shape,dtype=float,order='C')
shape 数组形状
dtype 返回ndarray的数据类型
(numpy.zeros_like() )
numpy.ones(shape,dtype=float,order='C')
shape 数组形状
dtype 返回ndarray的数据类型
(numpy.ones_like() )