def result(): #讀取excel檔 df = pd.read_excel("crash_all.xlsx") # 將其資料型態從 dataframe 變成 list # crash_all: 所有卡片的資訊 crash_all = np.array(df).tolist() same_cards = reclassify() result_lst = [] for i in range(len(same_cards)): lst_1 = same_cards[i] lst_4 = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] for j in range(len(lst_1)): lst_2 = lst_1[j] lst_3 = crash_all[lst_2] lst_4 = reshape(lst_3, which_class(lst_3), lst_4) result_lst.append(lst_4) print(result_lst) write_to_excel(result_lst, "result_lst.xlsx", "result_lst", mode=1)
def get_num_range(): init = 0 num_range = [] num_range_temp = [] crash_list = [a, b, c, d, e, f, g, h, i, j, k] for x in range(len(crash_list)): num_range_temp.append(init) num_range_temp.append(init + len(crash_list[x]) - 1) init += len(crash_list[x]) num_range.append(num_range_temp) num_range_temp = [] write_to_excel(num_range, "num_range.xlsx", "num_range")
def get_crash_all(): crash_all = a + b + c + d + e + f + g + h + i + j + k write_to_excel(crash_all, "crash_all.xlsx", "crash_all")