Qinglinz commited on
Commit
97847d3
1 Parent(s): 5558cd0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -60,23 +60,23 @@ def titanic(pclass, sex, age, fare, embarked, familysize, appellation, cabin):
60
 
61
  # Cabin
62
  if cabin == "A":
63
- input_list.append(1).append(0).append(0).append(0).append(0).append(0).append(0).append(0).append(0)
64
  elif cabin == "B":
65
- input_list.append(0).append(1).append(0).append(0).append(0).append(0).append(0).append(0).append(0)
66
  elif cabin == "C":
67
- input_list.append(0).append(0).append(1).append(0).append(0).append(0).append(0).append(0).append(0)
68
  elif cabin == "D":
69
- input_list.append(0).append(0).append(0).append(1).append(0).append(0).append(0).append(0).append(0)
70
  elif cabin == "E":
71
- input_list.append(0).append(0).append(0).append(0).append(1).append(0).append(0).append(0).append(0)
72
  elif cabin == "F":
73
- input_list.append(0).append(0).append(0).append(0).append(0).append(1).append(0).append(0).append(0)
74
  elif cabin == "G":
75
- input_list.append(0).append(0).append(0).append(0).append(0).append(0).append(1).append(0).append(0)
76
  elif cabin == "T":
77
- input_list.append(0).append(0).append(0).append(0).append(0).append(0).append(0).append(1).append(0)
78
  else:
79
- input_list.append(0).append(0).append(0).append(0).append(0).append(0).append(0).append(0).append(1)
80
 
81
 
82
  # 'res' is a list of predictions returned as the label.
 
60
 
61
  # Cabin
62
  if cabin == "A":
63
+ input_list.extend([1,0,0,0,0,0,0,0,0])
64
  elif cabin == "B":
65
+ input_list.extend([0,1,0,0,0,0,0,0,0])
66
  elif cabin == "C":
67
+ input_list.extend([0,0,1,0,0,0,0,0,0])
68
  elif cabin == "D":
69
+ input_list.extend([0,0,0,1,0,0,0,0,0])
70
  elif cabin == "E":
71
+ input_list.extend([0,0,0,0,1,0,0,0,0])
72
  elif cabin == "F":
73
+ input_list.extend([0,0,0,0,0,1,0,0,0])
74
  elif cabin == "G":
75
+ input_list.extend([0,0,0,0,0,0,1,0,0])
76
  elif cabin == "T":
77
+ input_list.extend([0,0,0,0,0,0,0,1,0])
78
  else:
79
+ input_list.extend([0,0,0,0,0,0,0,0,1])
80
 
81
 
82
  # 'res' is a list of predictions returned as the label.