numpy
numpy
in Python? 1 2 3
1
4
2 3
5 6 7 8
10 11 12
2-D NumPy Arrays
3-D NumPy Arrays
www.educba.com
oyuteg:
np.aruayllanlia,3,4s)
pudlaC:1)#[o|27
ButQoD:)#l2345)
uoys
Put(aC::27)+[o24]
me fo nuny)
Nata
nomby as npCnpu had
te iiot
idemty- npeyec?)
Printlidenity)# LLI.0.D]
Dees oealu a [0.1.0]
0.0.13]
le
gel)
Start=l &toposte
1o,2)#
Secl= nP. asamylI,
shoced nmbo)
stop-o,Jtoþ=s
npinsfacel (euuny
) Ch,lD,<+stavt-l, 10. J
=np dinshace 5.5 17s
&eq2
pritSeq# . 3.25
liofaii)
)
.
Houp:2
Srderig nd Siuingy
accei he 3elen
import nomy s np
arrau(Cjo,o,30, I0, 5o])
arr= n p.
rint Cal2])tt 3D
Caliugp:2,1:1 )t
np. median oy)
S])
qvô = nparrayCI,2,3,4
printnp.meay ar)t3.0
print Cnp.Std(avv))t soncdae deuah
Efoustia!
Prin (np.enpar) t E Rovt
(np-cgrtar))#dquaa
Prinl
hpng,1o).reshape C3.3)
cr
Print (arr)
rous lalmy
printarr.T)#wnpe
[3,)) hhorigontatl,
a= nparraycri,1,
5. 61,HS)
Ystock() b= np. array(
2 pintlnp- hatacpCCa b)))+[II256]
6)
ar2P=naitay(lLI, 2i3]Is,1))
arld =ari2D. la tt c)
pint Carrld)
+LI 2 3 45 6A8 9
Hour
Jatl:Nun,Qnoncecutang(Dydse
whut-b-0acashig: Yo plhaf.
imnport nemty as nf
nparay(lh2,31) 2 32 321)
PrintCa)
co natel
oetelyd3) hoibe)
Milhematicalaenalis
6teþl;_ Beosie
(uitl t
0mport numy as p 20, 30,4e])
ar|= np. ayroy(to, 4])
aYY2 =np.arrauCCI,213,
print(ar|tar)+ Ll22 33 447
orrt- rre)+[g 1 24 36]
Prirt 40 9o 1bo]
print avrl avr2 )+ L1o
Print avYl/ar2 o lo. Jo. 1o.]
ay np.avayCEojlo,5e2131)
Sortedar= n. sort lar!
Plnt(soYted_a)t Cjo 20 3o yo So
a2
anephp. cor
ayvay
fa(C221,C615,
6 1 5 , 1`)
0)
print (np.
t
cjrv=np. Orro(Ç lo,2p304o,S0])
ihceey npheu lorr >)
enrt(ehapedar)# LEI 2 31
[45
ylattenl):
Print Coeshapoaroavell)) #ti2 3450
hstlch()
Vectonged henalis m
Jastiahon
ayrznp.arayCli2i3,4s7)
Sqvand. appendCnum*2)
prirt(sqUoyed ) 4,3l625]
S uared = a t
print (Sqvored)
(arri2 np-powey boeiali
np-multtply
2) (anl,np.divide( mutipolyin np.dvide(
) hp.subtract hp.multily)eleentwne
np.add(arrlh
ar2) Sorailo ng.subtratl)
Addiia np.addl)
OrrE2,:]
arl:4] (oluwei
arr2]
Slicg ond, 3.uten
avel()
(3,hatelay,
3) hp.e (1b) avay am tattenp.ravel()
Realapenp.rchapel)
ndim aY. no.
aYray-ndim
Red
Curr.Si aelement aWay-sige
ar.shape dnmendiom avy Rotuw
Rolnuo.sma array-shaþe
p.rondom. olHamdoyno.
) (o. qeenale, tandon.TandC )
np Cueatlinu spacaC) np.np.
arrg np. ringre uitha Aag eatValea arange) np.
eyela) oealiidenlity
wabs hp.egel)
) np oealiavy Lreales
)) ones np. Oney sal. illd led bpones)
np.zeros)
) Zeno utl np.avray)
np.aoy Dexuá bal metians
chevetial np- oxpCar)
Natwl Aagathm hp loglarr)
n.qttlar)
np. sinl ) n
np- Sinlarr)
g.(osl ) np.(os lau)
np.tanl)
ng. tanla)
np. sum() np Surar)
np. me an) MeaAvg) np. meanl axx)
np.median( ) Medi
np. min(0 Mmimm Valey nemedianhar)
np. minarr
hp. ma x Monimm Val np.may(o)
p. std()
np.vasl)
atlondae
Vaiom
ceatiom n-stdlar)
ng-vaylay )