質問編集履歴
1
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
Pivot_Grp.sort_values('Growth',ascending=False).round().head(50)
|
18
18
|
|
19
|
-
|
19
|
+
iris=Pivot_Grp.sort_values('Growth',ascending=False).round().head(50)
|
20
20
|
|
21
21
|
#GSの設定
|
22
22
|
|
@@ -62,9 +62,7 @@
|
|
62
62
|
|
63
63
|
|
64
64
|
|
65
|
-
#
|
65
|
+
# GoogleSheetに書き出す
|
66
|
-
|
67
|
-
# 例:26→Z、27→AA、10000→NTP
|
68
66
|
|
69
67
|
def toAlpha(num):
|
70
68
|
|
@@ -82,17 +80,25 @@
|
|
82
80
|
|
83
81
|
|
84
82
|
|
85
|
-
col_lastnum = len(data.columns) # DataFrameの列数
|
86
|
-
|
87
|
-
row_lastnum = len(data.index) # DataFrameの行数
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
cell_list = worksheet.range('A1:'+toAlpha(col_lastnum)+str(row_lastnum))
|
83
|
+
cell_list = worksheet.range('A1:'+toAlpha(col_lastnum+1)+str(row_lastnum+1))
|
92
84
|
|
93
85
|
for cell in cell_list:
|
94
86
|
|
87
|
+
if cell.col == 1 and cell.row == 1:
|
88
|
+
|
89
|
+
val = ''
|
90
|
+
|
91
|
+
elif cell.col == 1:
|
92
|
+
|
93
|
+
val = iris.index[cell.row-2]
|
94
|
+
|
95
|
+
elif cell.row == 1:
|
96
|
+
|
97
|
+
val = iris.columns[cell.col-2]
|
98
|
+
|
99
|
+
else:
|
100
|
+
|
95
|
-
val = iris.iloc[cell.row-
|
101
|
+
val = iris.iloc[cell.row-2][cell.col-2]
|
96
102
|
|
97
103
|
cell.value = val
|
98
104
|
|
@@ -108,9 +114,7 @@
|
|
108
114
|
|
109
115
|
【エラーメッセ】
|
110
116
|
|
111
|
-
|
117
|
+
index 3 is out of bounds for axis 0 with size 3
|
112
|
-
|
113
|
-
そして、成功した時には、コラムの部分(Servedの数字のみ)シートにいきました。
|
114
118
|
|
115
119
|
|
116
120
|
|