攝影或3C

Python data = numpy.zeros( (4,6,2), dtype=float) ; print(data.shape); min0 = numpy.min(a,axis=0) ; min1 = numpy.min(a,axis=1) #2次沿軸1 ; numpy.average() ;array的軸向

import numpy as np

data = np.zeros((4,6,2),dtype=float)
print(data)

print(data.shape)
print(data.shape[0])
print(data.shape[1])
print(data.shape[2])

 

import numpy as np

data = np.zeros((4,6,2),dtype=float)
print(data)

print(data.shape)
print(data.shape[0])
print(data.shape[1])
print(data.shape[2])

a = np.array([ [1,5,3],[4,2,6] ])
print(a)
min0 = np.min(a,axis=0) #3次沿軸0
min1 = np.min(a,axis=1) #2次沿軸1
print(“沿軸0的最小值:”,min0)
print(“沿軸1的最小值:”,min1)

 

import numpy as np
ripple_mag=np.array( \
([1,2],[2,2],[3,2],[4,2],[5,2],[6,2]),dtype=float )
print(ripple_mag)
print(ripple_mag.shape)

print( “index 0: \n”,ripple_mag[0:] )
print( “index 1: \n”,ripple_mag[1:] )
print( “index 2: \n”,ripple_mag[2:] )
print( “index 3: \n”,ripple_mag[3:] )
print( “index 4: \n”,ripple_mag[4:] )
print( “index 5: \n”,ripple_mag[5:] )

print( [np.average(ripple_mag[0:]) ] )

#(1+2+2+2+3+2+4+2+5+2+6+2)/12 = 2.75
print( [np.average(ripple_mag[i:]) for i in range(6) ] )

output:

 

array的軸向:

推薦hahow線上學習python: https://igrape.net/30afN

儲蓄保險王

儲蓄險是板主最喜愛的儲蓄工具,最喜愛的投資理財工具則是ETF,最喜愛的省錢工具則是信用卡