Skip to content

Commit c156046

Browse files
committed
correct my homework answer after understand
1 parent 3475e7a commit c156046

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

D15_groupy/homework.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
print( score_df.groupby(['class']).agg(['max','min']) )
1111

1212
# 找出數學班平均最高的班級?
13-
print( score_df.groupby(['class']).math_score.agg(['max']))
13+
# print( score_df.groupby(['class']).math_score.agg(['max']))
14+
print( score_df.groupby(['class']).math_score.mean() )
1415

1516
# 分析全校女生與男生國文平均差幾分?
16-
print( score_df.groupby(['sex']).chinese_score.agg(['mean']))
17+
print( A:=score_df.groupby(['sex']).chinese_score.agg(['mean']))
18+
print( '全校女生與男生國文平均差幾分 %f' % (float(A.values[0])-float(A.values[1]) ) )

0 commit comments

Comments
 (0)