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的軸向

加入好友
加入社群
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])

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])

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)

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
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) ] )

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的軸向 - 儲蓄保險王

output:

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的軸向 - 儲蓄保險王

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的軸向 - 儲蓄保險王

 

array的軸向:

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的軸向 - 儲蓄保險王

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

加入好友
加入社群
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的軸向 - 儲蓄保險王

儲蓄保險王

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

You may also like...

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *