Skip to content

Commit c905384

Browse files
committed
correct Day5 homework and upload Day6 homework
1 parent 44c2f88 commit c905384

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

D05/homework.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@ def Tstd():
3939

4040
#2. 第五位同學補考數學後成績為 55,請計算補考後數學成績平均、最大值、最小值、標準差?
4141
math_score[4]=55
42-
Tavg()
43-
Tmax()
44-
Tmin()
45-
Tstd()
42+
print("補考數學後")
43+
print("數學分數 ","平均",np.nanmean(math_score),"最大值",np.nanmax(math_score),"最小值",np.nanmin(math_score),"標準差",np.nanstd(math_score))
4644

4745
#3. 用補考後資料找出與國文成績相關係數最高的學科?
4846
E=np.corrcoef(english_score, chinese_score)

D06/homework.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import numpy as np
2+
3+
array1 = np.array(range(30))
4+
array2 = np.array([2,3,5])
5+
array3 = np.array([[4,5,6], [1,2,3]])
6+
#將兩列 array 存成 npz 檔
7+
with open('array.npz','wb') as f:
8+
np.savez(f, array1, array2)
9+
10+
#讀取剛剛的 npz 檔,加入下列 array 一起存成新的 npz 檔
11+
npzfile = np.load('array.npz')
12+
A1 = npzfile['arr_0']
13+
A2 = npzfile['arr_1']
14+
15+
print(A1, A2)
16+
17+
with open('final123.npz','wb') as f:
18+
np.savez(f, A1, A2, array3)
19+
20+
Finally=np.load('final123.npz')
21+
print(Finally.files)

0 commit comments

Comments
 (0)