回答編集履歴

1

追記

2021/01/06 06:05

投稿

meg_
meg_

スコア10582

test CHANGED
@@ -37,3 +37,57 @@
37
37
  #c:リーチカウント1
38
38
 
39
39
  ```
40
+
41
+
42
+
43
+ ---
44
+
45
+ 【追記】
46
+
47
+ 数字+X が Xで終わることが前提となります。
48
+
49
+
50
+
51
+ ```Python
52
+
53
+ df = df.astype(str)
54
+
55
+
56
+
57
+ for c in df.columns:
58
+
59
+ count = sum(df[c].str.endswith('X')) + sum(df[c] == 'フリー')
60
+
61
+ if count == 5:
62
+
63
+ print(f'{c}:カウント1')
64
+
65
+ elif count == 4:
66
+
67
+ print(f'{c}:リーチカウント1')
68
+
69
+
70
+
71
+ for r in df.index:
72
+
73
+ count = sum(df.loc[r].str.endswith('X')) + sum(df.loc[r] == 'フリー')
74
+
75
+ if count == 5:
76
+
77
+ print(f'{r}:カウント1')
78
+
79
+ elif count == 4:
80
+
81
+ print(f'{r}:リーチカウント1')
82
+
83
+ #w:カウント1
84
+
85
+ #y:リーチカウント1
86
+
87
+ #b:リーチカウント1
88
+
89
+ #c:リーチカウント1
90
+
91
+ ```
92
+
93
+ ※dfの型を変えたくない場合はdf2 = df.astype(str).copy()などどしてください。その後のコードは適時修正ください。