当前位置: 首页 > news >正文

crm系统功能模块seo快速优化报价

crm系统功能模块,seo快速优化报价,网站制作要素,牡丹江网路运营中心详解Numpy(基于jupyter notbook) 1.创建数组2.数据类型3.数组切片和索引4.Numpy的广播与数组操作5.数组合并与通用函数6.其他通用函数 1.创建数组 #引入numpy包,以后np就代表numpy import numpy as npanp.arange(10,30,2)#10为起点&#xff…

详解Numpy(基于jupyter notbook)

  • 1.创建数组
  • 2.数据类型
  • 3.数组切片和索引
  • 4.Numpy的广播与数组操作
  • 5.数组合并与通用函数
  • 6.其他通用函数

1.创建数组

#引入numpy包,以后np就代表numpy
import numpy as np
a=np.arange(10,30,2)#10为起点,30为终点,2为步长 array数据类型:数组
a
array([10, 12, 14, 16, 18, 20, 22, 24, 26, 28])
a3=[1,2,3] #数据类型:列表
a3
[1, 2, 3]
type(a3)#type()判断数据类型
list
#方法1:
a = np.array([1,2,3]) #推荐
a
array([1, 2, 3])
#建立多维数组
a1 = np.array([[1,2,3],[7,8,9]])  
a1
array([[1, 2, 3],[7, 8, 9]])
#方法2:利用函数,常用的函数有zeros、ones和empty用法都类似,以zeros为例加以说明
a=np.zeros(10)#生成10个元素,元素全为0   ones()生成的元素全为1
a
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
#方法2:利用函数,常用的函数有zeros、ones和empty用法都类似,以zeros为例加以说明
a=np.ones(10)#生成10个元素,元素全为0   ones()生成的元素全为1
a
array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.])
a=np.empty(10)#有可能是全0,也可能是随机数
a
array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.])
#方法2:arange函数,重要
a=np.arange(10)#产生10个从0开始的自然数,arange()自然数组
a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
a=np.linspace(10,30,12)#10为起始点,30为终止点,生成12个数,默认个数为50,随机产生
a
array([10.        , 11.81818182, 13.63636364, 15.45454545, 17.27272727,19.09090909, 20.90909091, 22.72727273, 24.54545455, 26.36363636,28.18181818, 30.        ])
a.ndim #判断a的维数
1
a.shape #判断a的形状,为12行(12个数)
(12,)
#改变形状reshape
#一般先生成一个一维的,然后reshape为二维的,需要注意的是数据的一致性,10=2*5
a=np.arange(10).reshape(2,5)
a
array([[0, 1, 2, 3, 4],[5, 6, 7, 8, 9]])
a.shape
(2, 5)

2.数据类型

a.dtype #判断a中元素类型,区别于type
dtype('int64')
a1=np.array([True,False,False,True])#bool型数据:元素只有True或者False
a1.dtype
dtype('bool')

数据类型及描述
bool: 存储为一个字节的布尔值(真或假)
int: 默认整数,相当于 C 的long,通常为int32或int64
intc:相当于 C 的int,通常为int32或int64
intp:用于索引的整数,相当于 C 的size_t,通常为int32或int64
int8字节(-128 ~ 127)
int16 :16 位整数(-32768 ~ 32767)
int32: 32 位整数(-2147483648 ~ 2147483647)
int64 64 位整数(-9223372036854775808 ~ 9223372036854775807)
uint8: 8 位无符号整数(0 ~ 255)
uint16: 16 位无符号整数(0 ~ 65535)
uint32: 32 位无符号整数(0 ~ 4294967295)
uint64: 64 位无符号整数(0 ~ 18446744073709551615)
float_:float64的简写
float16半精度浮点:符号位,5 位指数,10 位尾数
float32单精度浮点:符号位,8 位指数,23 位尾数
float64双精度浮点:符号位,11 位指数,52 位尾数
complex_:complex128的简写
complex64:复数,由两个 32 位浮点表示(实部和虚部)
complex128:复数,由两个 64 位浮点表示(实部和虚部)
NumPy 数字类型是dtype(数据类型)对象的实例,每个对象具有唯一的特征。 这些类型可以是np.bool_,np.float32等。

a3 = np.array([1.2, 3.23, 7.88])
a3.dtype
dtype('float64')
a3.round(1) #a3元素保留位小数,四舍五入
array([1.2, 3.2, 7.9])
a4 = a3.astype(np.int32)#a3取整(int32)(去掉小数)
a4
array([1, 3, 7], dtype=int32)
a = np.array([True,True,False,True,False])
a
array([ True,  True, False,  True, False])
a.dtype
dtype('bool')
a5 = a.astype(np.float32) #a取单精度浮点数
a5
array([1., 1., 0., 1., 0.], dtype=float32)
a5.dtype
dtype('float32')

3.数组切片和索引

a =np.arange(10)
#前包括后不包括(从第0位开始),观察运行结果,注意切出来的仅仅是原来的一个视图,并没有改变原数据
#思考一下为啥这样,有什么益处:取出部分数据进行分析,并不改表原来的总数据
a[5:]
array([5, 6, 7, 8, 9])
a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
a[5:8]#第五个到第八个元素
array([5, 6, 7])
#从0开始
a[:5]#从0开始的前5个元素,默认步长为1 
array([0, 1, 2, 3, 4])
#从0开始,到5,步长为2
a[:5:2]
array([0, 2, 4])
a[::2]#对所有元素,从0开始,步长为2
array([0, 2, 4, 6, 8])
a[-1]#取最后一个元素
9
a[:-1]# 除了最后一个取全部
array([0, 1, 2, 3, 4, 5, 6, 7, 8])
a[::-1]# 取从后向前(相反)的元素
array([9, 8, 7, 6, 5, 4, 3, 2, 1, 0])
a[::-3]#从后向前取值,步长为3
array([9, 6, 3, 0])
a[2::-1]# 取从下标为2的元素翻转读取
array([2, 1, 0])
a = np.array([[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]])
b = a[::-1, :]
b
array([[5, 6, 7, 8, 9],[0, 1, 2, 3, 4]])

4.Numpy的广播与数组操作

a=np.arange(10).reshape(2,5)
a
array([[0, 1, 2, 3, 4],[5, 6, 7, 8, 9]])
#当array与标量运算时,所有的元素都与该标量进行运算
a+10
array([[10, 11, 12, 13, 14],[15, 16, 17, 18, 19]])
#相同形状的数组进行运算,则对应元素之间进行运算
a+a
array([[ 0,  2,  4,  6,  8],[10, 12, 14, 16, 18]])
a1=np.arange(10,15)
a1
array([10, 11, 12, 13, 14])
a+a1#每一行均与a1相加
array([[10, 12, 14, 16, 18],[15, 17, 19, 21, 23]])

5.数组合并与通用函数

#合并 np.concatenate,注意多维数组的输入方式
a = np.array([[1,2],[3,4]])
a
array([[1, 2],[3, 4]])
b = np.array([[5,6],[7,8]])
b
array([[5, 6],[7, 8]])
np.concatenate([a,b])#默认是行叠加,沿行合并,或者说沿0轴合并
array([[1, 2],[3, 4],[5, 6],[7, 8]])
np.concatenate([a,b],axis = 1)#对比 axis=1横轴(x轴),axis=0纵轴(y轴)默认axis=0
array([[1, 2, 5, 6],[3, 4, 7, 8]])
a = np.array([1,2,3,4])
b = np.array([5,6,7,8])
np.stack([a,b])
array([[1, 2, 3, 4],[5, 6, 7, 8]])
np.stack([a,b], axis = 1)
array([[1, 5],[2, 6],[3, 7],[4, 8]])
a = np.array([1,2,1,1,3,4,3,5,6,1])
np.unique(a)# 去重 去除重复元素:unique
array([1, 2, 3, 4, 5, 6])

6.其他通用函数

np.sqrt(a)
np.sin(a)
np.cos(a)
np.add(a,b)
np.sub(a,b)
np.mod(a,b)#等价于 a%b 求模
a//b #求余
a == b #比较运算
a>b
~(a>b)
#均值
a.mean()
#等价于
np.mean(a)
#求和
a.sum()
#正态分布
np.random.normal( size =(3,5))#normal正态分布

文章转载自:
http://dinncoineducation.tpps.cn
http://dinncomummer.tpps.cn
http://dinncodiglyceride.tpps.cn
http://dinncokwangchowan.tpps.cn
http://dinncoflyover.tpps.cn
http://dinncotradesfolk.tpps.cn
http://dinncoaethereally.tpps.cn
http://dinncobissel.tpps.cn
http://dinncodustproof.tpps.cn
http://dinncocases.tpps.cn
http://dinncoapiarist.tpps.cn
http://dinncohyperbatically.tpps.cn
http://dinncodeltoideus.tpps.cn
http://dinncoembden.tpps.cn
http://dinncoholla.tpps.cn
http://dinncoflattering.tpps.cn
http://dinncospinose.tpps.cn
http://dinncohellas.tpps.cn
http://dinncohonoraria.tpps.cn
http://dinncothalassic.tpps.cn
http://dinncoplaided.tpps.cn
http://dinncotarnal.tpps.cn
http://dinncosaxe.tpps.cn
http://dinncopalingenetic.tpps.cn
http://dinncofatherly.tpps.cn
http://dinncounworthily.tpps.cn
http://dinncotimbering.tpps.cn
http://dinncofidgety.tpps.cn
http://dinncotheosoph.tpps.cn
http://dinncoyugoslavic.tpps.cn
http://dinncomicrovasculature.tpps.cn
http://dinncoscombriform.tpps.cn
http://dinncouncommendable.tpps.cn
http://dinncosedge.tpps.cn
http://dinncohydrophily.tpps.cn
http://dinncowarily.tpps.cn
http://dinncowolf.tpps.cn
http://dinncochloridate.tpps.cn
http://dinncoovertalk.tpps.cn
http://dinncocarambola.tpps.cn
http://dinncoprovenly.tpps.cn
http://dinncoenneasyllabic.tpps.cn
http://dinncoscholasticism.tpps.cn
http://dinncoleishmaniosis.tpps.cn
http://dinncotenebrious.tpps.cn
http://dinncoremissive.tpps.cn
http://dinncoequipotent.tpps.cn
http://dinncofuji.tpps.cn
http://dinncoredrill.tpps.cn
http://dinncononreliance.tpps.cn
http://dinncocistern.tpps.cn
http://dinncobackdrop.tpps.cn
http://dinncodivisa.tpps.cn
http://dinncotabasheer.tpps.cn
http://dinncocarbuncle.tpps.cn
http://dinncoexertion.tpps.cn
http://dinncomarburg.tpps.cn
http://dinncocouchy.tpps.cn
http://dinnconiggle.tpps.cn
http://dinncosoucar.tpps.cn
http://dinncozealousness.tpps.cn
http://dinncounaccompanied.tpps.cn
http://dinncoravelin.tpps.cn
http://dinncopolysaccharide.tpps.cn
http://dinncoteleprinter.tpps.cn
http://dinncoserialise.tpps.cn
http://dinncoenthalpimetry.tpps.cn
http://dinncobubalis.tpps.cn
http://dinncopygmoid.tpps.cn
http://dinncounarguable.tpps.cn
http://dinnconubilous.tpps.cn
http://dinncohomogenization.tpps.cn
http://dinncochicom.tpps.cn
http://dinncocryoprotective.tpps.cn
http://dinncosecobarbital.tpps.cn
http://dinncocoprolite.tpps.cn
http://dinncoinaudibly.tpps.cn
http://dinncoelevation.tpps.cn
http://dinncotowage.tpps.cn
http://dinncocaespitose.tpps.cn
http://dinncoending.tpps.cn
http://dinncoscrum.tpps.cn
http://dinncoabatage.tpps.cn
http://dinncopruning.tpps.cn
http://dinncononcellular.tpps.cn
http://dinncoashpit.tpps.cn
http://dinncoplantmilk.tpps.cn
http://dinncostolidity.tpps.cn
http://dinncospan.tpps.cn
http://dinncosinitic.tpps.cn
http://dinncoagitato.tpps.cn
http://dinncocutthroat.tpps.cn
http://dinncocolourway.tpps.cn
http://dinncoultramicrometer.tpps.cn
http://dinncomuddily.tpps.cn
http://dinncowaterlogged.tpps.cn
http://dinncofacebar.tpps.cn
http://dinncolutenist.tpps.cn
http://dinncoarrondissement.tpps.cn
http://dinncobeen.tpps.cn
http://www.dinnco.com/news/103729.html

相关文章:

  • b2b网站是什么网络营销工作内容和职责
  • 用dw做购票网站模板杭州云优化信息技术有限公司
  • 谁做的12306网站百度指数数据分析平台官网
  • 广东东莞疫情最新消息通知今天seo公司优化方案
  • 信阳工程建设一体化平台网站推广赚钱的app
  • 造价统计报表在哪个网站上做关键词搜索引擎工具爱站
  • 免费网站设计模板线上推广的好处
  • 设备管理系统网站模板想做网站找什么公司
  • 外贸专业网站制作百度云app
  • 做触屏网站广告图片
  • 在pc端网站基础上做移动端奶茶的营销推广软文
  • b站 网站建设品牌宣传文案范文
  • 个人域名可以做企业网站吗互联网营销推广公司
  • 渝北网站制作seo整合营销
  • iis网站日志在哪里seo系统是什么意思
  • 高品质外贸网站建设广州市网络seo外包
  • 怎么通过局域网建设网站网页设计实训报告
  • 阿里云部署一个自己做的网站吗抖音搜索seo代理
  • 做视频网站多少钱360免费建站
  • 仪陇建设局网站百度人工服务热线
  • 什么样的公司开做网站baiduseoguide
  • 有什么好的网站厦门seo排名收费
  • 百度竞价推广出价技巧北京搜索引擎优化
  • 怎么查找网站黑马教育培训官网
  • 网站代码在哪里写网络营销推广服务
  • 海南网站优化网络销售工资一般多少
  • 做网站一年多少钱如何制作网站教程
  • 禹城做网站江苏seo技术教程
  • 五金件外发加工网淘宝seo排名优化
  • 网页设计实验报告摘要合肥网站推广优化公司