import numpy
as np
a
= np
.dtype
(int)
print(a
.type)
print(a
.itemsize
)
print(a
)
b
=np
.busday_count
('2020-10-20','2020-12-31', weekmask
='1111101')
print(b
)
c
= np
.busday_offset
('2020-10-24',offsets
=1, weekmask
='1111100',roll
='backward')
print(c
)
d
= np
.array
([[(1,1.1),(2,2.2)],
[(3,3.3),(4,4.4)]])
print(d
,d
.dtype
,type(d
))
def f(x
,y
):
return x
+2*y
e
=np
.fromfunction
(f
,(3,3),dtype
=int)
print(e
)
x
= np
.full
((2,),7)
x_
= np
.full
((2,1),7)
y
= np
.ones
((2,),dtype
=int)
print(x
,'\n',x_
,'\n',y
)
import numpy
as np
import datetime
persontype
=np
.dtype
({
'name':['name','age','weight'],
'formats':['U30','i8','f8']})
a
=np
.array
([('li',18,65)],dtype
=persontype
)
print(a
,type(a
))
转载请注明原文地址: https://lol.8miu.com/read-10536.html