import numpy as np
a = np.array([[1, 2, 3], [4, 5, 6]])
mean_along_rows = np.mean(a, axis=0)
print(mean_along_rows)
mean_along_columns = np.mean(a, axis=1)
print(mean_along_columns)

numpy.max() ;
numpy.min()
numpy.argmax() #沿軸max的index
numpy.argmin() #沿軸min的index
axis參數同numpy.mean()
推薦hahow線上學習python: https://igrape.net/30afN
import numpy as np
a = np.array([[1, 2, 3], [4, 5, 6]])
max_along_rows = np.max(a, axis=0)
print(“max_along_rows:”, max_along_rows)
max_along_columns = np.max(a, axis=1)
print(“max_along_columns:”, max_along_columns)
argmax_along_rows = np.argmax(a, axis=0)
print(“argmax_along_rows:”, argmax_along_rows)
argmax_along_columns = np.argmax(a, axis=1)
print(“argmax_along_columns:”, argmax_along_columns)

推薦hahow線上學習python: https://igrape.net/30afN
![Python: pandas.read_excel(r”路徑\檔名.副檔名”, header = None), 自動加上0,1…的欄標籤, DataFrame如何取某一直欄或橫列? 如何用 .iloc[bool_list] 取出判斷式為真的那一列? bool_list = list( df[0] == 0 ) ; bool_list = list(df[0].isin([0])) ; DataFrame如何顯示完整的資料? pandas.set_option ( “display.max_rows”, None) Python: pandas.read_excel(r”路徑\檔名.副檔名”, header = None), 自動加上0,1…的欄標籤, DataFrame如何取某一直欄或橫列? 如何用 .iloc[bool_list] 取出判斷式為真的那一列? bool_list = list( df[0] == 0 ) ; bool_list = list(df[0].isin([0])) ; DataFrame如何顯示完整的資料? pandas.set_option ( “display.max_rows”, None)](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2022/11/20221128164005_44.png?quality=90&zoom=2&ssl=1&resize=350%2C233)


![Python TQC考題610 平均溫度,不要自找麻煩用2D list做,可練習2D轉1D: 一維串列.extend(二維串列[index]) Python TQC考題610 平均溫度,不要自找麻煩用2D list做,可練習2D轉1D: 一維串列.extend(二維串列[index])](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2022/05/20220515192908_35.png?quality=90&zoom=2&ssl=1&resize=350%2C233)






近期留言