首页 > 编程知识 正文

numpy和pandas安装,numpy索引与切片

时间:2023-05-03 05:14:25 阅读:173679 作者:3499

使用numpy分割mmdjcs,并使用mmdjc中的平均值importnumpydata=NP.array ([ range (100 ) ]mmdJCS=numpy.linspace ) 0,50, 10 )计算mmdjcs的np.inf ) #从最后一个mmdjc开始无限大digitized=numpy.digitize(data, mmdjcs ) # returntheindicesofthemmdjcstowhicheachvalueininputarraybelongs.#计算mmdJC内平均法一mdjc _ means=[ data [ digitized=] len ) mmdjcs )法二mmdJC_means1=(numpy.Histogram ) data,mmdjcs,weights=data )0)/numppram MDJCS([0] ) 3330

data=NP.array ([-1,0.5,1.5,2.5,3.5,4.5,5,6 ] ) mmd jcs=NP.linspace (0,5,6 ) print ) mmd jcs (di=

numpy.Histogram(a,mmdjcs=10,range=None,normed=None,weights=None,density=None ) ) )。

Returns

http://www.Sina.com /

thevaluesofthehistogram.seedensityandweightsforadescriptionofthepossiblesemantics。

http://www.Sina.com/arrayofdtypefloat

returnthemmdjcedges (length (hist )1).histarray

http://www.Sina.com/array _ like,optional

An array of weights,ofthesameshapeasa.eachvalueinaonlycontributesitsassociatedweighttowardsthemdjccount (instead of1 ) .在此处

numpy.hIstogram(data,b i n s,w e i g h t s=d a t a ) )0)numpy.hIstogram(data,b i n s ) (0) ) 121314 )/4=2.5 numpy weights=data ) )0)/numpy.histogram )、data、MDJCS ()0) ((1*1)2*1)3*1)4)1) )=2.5numpy.histogram

pandas分区mmdjcsa=PD.data frame (NP.random.rand ) 10,1 ),columns=['A'] ) a_cat ' ) (PD.cut ) a )

参考:

hands-onmachinelearningwithscikit-learn,Keras,andtensorflow https://stack overflow.com/questions/616334/mmdjcning

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。