-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathunpack.py
42 lines (33 loc) · 1006 Bytes
/
unpack.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import pandas as pd
def unpack_df(cards):
number = []
shape = []
color = []
shading = []
for card in cards:
number.append(card[0])
shape.append(card[1])
color.append(card[2])
shading.append(card[3])
df = pd.DataFrame({'number':number,'shape':shape,'color':color,'shading':shading})
return df
def unpack_dict(cards):
board = {}
for i in range(0,len(cards)):
board[i] ={'number':cards[i][0],
'shape':cards[i][1],
'color':cards[i][2],
'shading':cards[i][3]}
return board
def unpack_result(cards):
predictions = []
for card in cards:
predictions.append(list(card[1]))
board = {}
for i in range(0,len(cards)):
board[i] ={'number':predictions[i][0],
'shape':predictions[i][1],
'color':predictions[i][2],
'shading':predictions[i][3]}
print(board)
return board