#実装したい事
下記の表で、表側と表頭を合わせて表として実行しているが、表側と表頭を別にして
同じような処理をしたい。
「電源ボタン」「ビデオボタン」「静止ボタン」と「動作」という風に分けて処理したい
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
電源ボタン T T T T T T T T F F F F F F F F
ビデオボタン T T T T F F F F T T T T F F F F
静止ボタン T T F F T T F F T T F F T T F F
動作 T F T F T F T F T F T F T F T F
python
1front_table = { 2 '操作':['電源ボタン','ビデオボタン'] 3} 4 5table_head = { 6 '期待動作':['動作'] 7} 8 9def combination_TF(front_table,table_head): 10 table_index = front_table + table_head 11 combination = itertools.product(*([true_mark,false_mark],)*len(table_index)) 12 13 dataTF = [[] for i in range(len(table_index))] 14 for com in combination: 15 for element_count,authenticity in enumerate(com): 16 dataTF[element_count].append(authenticity) 17 return (dataTF, table_index) 18 19data, conditions = combination_TF(front_table['操作'],table_head['期待動作']) 20df = pd.DataFrame(data,index=conditions) 21print(df)
出来れば関数でやりたいので、教えて頂きたいと思います。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/09/22 08:11
2017/09/22 12:02 編集
2017/09/22 12:01