Code Duplication    Length = 127-130 lines in 2 locations

excelexporters/spacestatistics.py 1 location

@@ 186-315 (lines=130) @@
183
184
        return filename
185
186
    if has_energy_data_flag:
187
        ws['B6'].font = title_font
188
        ws['B6'] = name + ' 统计分析'
189
        # ws['D6'].font = title_font
190
        # ws['D6'] = '面积' +report['space']['area']
191
192
        category = reporting_period_data['names']
193
194
        # table_title
195
        ws['B7'].fill = table_fill
196
        ws['B7'].font = title_font
197
        ws['B7'].alignment = c_c_alignment
198
        ws['B7'] = '报告期'
199
        ws['B7'].border = f_border
200
201
        ws['C7'].font = title_font
202
        ws['C7'].alignment = c_c_alignment
203
        ws['C7'] = '算术平均数'
204
        ws['C7'].border = f_border
205
206
        ws['D7'].font = title_font
207
        ws['D7'].alignment = c_c_alignment
208
        ws['D7'] = '中位数'
209
        ws['D7'].border = f_border
210
211
        ws['E7'].font = title_font
212
        ws['E7'].alignment = c_c_alignment
213
        ws['E7'] = '最小值'
214
        ws['E7'].border = f_border
215
216
        ws['F7'].font = title_font
217
        ws['F7'].alignment = c_c_alignment
218
        ws['F7'] = '最大值'
219
        ws['F7'].border = f_border
220
221
        ws['G7'].font = title_font
222
        ws['G7'].alignment = c_c_alignment
223
        ws['G7'] = '样本标准差'
224
        ws['G7'].border = f_border
225
226
        ws['H7'].font = title_font
227
        ws['H7'].alignment = c_c_alignment
228
        ws['H7'] = '样本方差'
229
        ws['H7'].border = f_border
230
231
        # table_data
232
233
        for i, value in enumerate(category):
234
            row = i*2 + 8
235
            ws['B' + str(row)].font = name_font
236
            ws['B' + str(row)].alignment = c_c_alignment
237
            ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + " )"
238
            ws['B' + str(row)].border = f_border
239
240
            ws['B' + str(row + 1)].font = name_font
241
            ws['B' + str(row + 1)].alignment = c_c_alignment
242
            ws['B' + str(row + 1)] = "环比"
243
            ws['B' + str(row + 1)].border = f_border
244
245
            ws['C' + str(row)].font = name_font
246
            ws['C' + str(row)].alignment = c_c_alignment
247
            ws['C' + str(row)] = round(reporting_period_data['means'][i], 2) \
248
                if reporting_period_data['means'][i] is not None else ''
249
            ws['C' + str(row)].border = f_border
250
251
            ws['C' + str(row + 1)].font = name_font
252
            ws['C' + str(row + 1)].alignment = c_c_alignment
253
            ws['C' + str(row + 1)] = str(round(reporting_period_data['means_increment_rate'][i] * 100, 2)) + "%" \
254
                if reporting_period_data['means_increment_rate'][i] is not None else '0.00%'
255
            ws['C' + str(row + 1)].border = f_border
256
257
            ws['D' + str(row)].font = name_font
258
            ws['D' + str(row)].alignment = c_c_alignment
259
            ws['D' + str(row)] = round(reporting_period_data['medians'][i], 2) \
260
                if reporting_period_data['medians'][i] is not None else ''
261
            ws['D' + str(row)].border = f_border
262
263
            ws['D' + str(row + 1)].font = name_font
264
            ws['D' + str(row + 1)].alignment = c_c_alignment
265
            ws['D' + str(row + 1)] = str(round(reporting_period_data['medians_increment_rate'][i] * 100, 2)) + "%" \
266
                if reporting_period_data['medians_increment_rate'][i] is not None else '0.00%'
267
            ws['D' + str(row + 1)].border = f_border
268
269
            ws['E' + str(row)].font = name_font
270
            ws['E' + str(row)].alignment = c_c_alignment
271
            ws['E' + str(row)] = round(reporting_period_data['minimums'][i], 2) \
272
                if reporting_period_data['minimums'][i] is not None else ''
273
            ws['E' + str(row)].border = f_border
274
275
            ws['E' + str(row + 1)].font = name_font
276
            ws['E' + str(row + 1)].alignment = c_c_alignment
277
            ws['E' + str(row + 1)] = str(round(reporting_period_data['minimums_increment_rate'][i] * 100, 2)) + "%" \
278
                if reporting_period_data['minimums_increment_rate'][i] is not None else '0.00%'
279
            ws['E' + str(row + 1)].border = f_border
280
281
            ws['F' + str(row)].font = name_font
282
            ws['F' + str(row)].alignment = c_c_alignment
283
            ws['F' + str(row)] = round(reporting_period_data['maximums'][i], 2) \
284
                if reporting_period_data['maximums'][i] is not None else ''
285
            ws['F' + str(row)].border = f_border
286
287
            ws['F' + str(row + 1)].font = name_font
288
            ws['F' + str(row + 1)].alignment = c_c_alignment
289
            ws['F' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \
290
                if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%'
291
            ws['F' + str(row + 1)].border = f_border
292
293
            ws['G' + str(row)].font = name_font
294
            ws['G' + str(row)].alignment = c_c_alignment
295
            ws['G' + str(row)] = round(reporting_period_data['stdevs'][i], 2) \
296
                if reporting_period_data['stdevs'][i] is not None else ''
297
            ws['G' + str(row)].border = f_border
298
299
            ws['G' + str(row + 1)].font = name_font
300
            ws['G' + str(row + 1)].alignment = c_c_alignment
301
            ws['G' + str(row + 1)] = str(round(reporting_period_data['stdevs_increment_rate'][i] * 100, 2)) + "%" \
302
                if reporting_period_data['stdevs_increment_rate'][i] is not None else '0.00%'
303
            ws['G' + str(row + 1)].border = f_border
304
305
            ws['H' + str(row)].font = name_font
306
            ws['H' + str(row)].alignment = c_c_alignment
307
            ws['H' + str(row)] = round(reporting_period_data['variances'][i], 2) \
308
                if reporting_period_data['variances'][i] is not None else ''
309
            ws['H' + str(row)].border = f_border
310
311
            ws['H' + str(row + 1)].font = name_font
312
            ws['H' + str(row + 1)].alignment = c_c_alignment
313
            ws['H' + str(row + 1)] = str(round(reporting_period_data['variances_increment_rate'][i] * 100, 2)) + "%" \
314
                if reporting_period_data['variances_increment_rate'][i] is not None else '0.00%'
315
            ws['H' + str(row + 1)].border = f_border
316
    #################################################
317
    # First: 统计分析
318
    # 13: title

excelexporters/tenantstatistics.py 1 location

@@ 185-311 (lines=127) @@
182
183
        return filename
184
185
    if has_energy_data_flag:
186
        ws['B5'].font = title_font
187
        ws['B5'] = name + ' 统计分析'
188
189
        category = reporting_period_data['names']
190
191
        # table_title
192
        ws['B6'].fill = table_fill
193
        ws['B6'].font = title_font
194
        ws['B6'].alignment = c_c_alignment
195
        ws['B6'] = '报告期'
196
        ws['B6'].border = f_border
197
198
        ws['C6'].font = title_font
199
        ws['C6'].alignment = c_c_alignment
200
        ws['C6'] = '算术平均数'
201
        ws['C6'].border = f_border
202
203
        ws['D6'].font = title_font
204
        ws['D6'].alignment = c_c_alignment
205
        ws['D6'] = '中位数'
206
        ws['D6'].border = f_border
207
208
        ws['E6'].font = title_font
209
        ws['E6'].alignment = c_c_alignment
210
        ws['E6'] = '最小值'
211
        ws['E6'].border = f_border
212
213
        ws['F6'].font = title_font
214
        ws['F6'].alignment = c_c_alignment
215
        ws['F6'] = '最大值'
216
        ws['F6'].border = f_border
217
218
        ws['G6'].font = title_font
219
        ws['G6'].alignment = c_c_alignment
220
        ws['G6'] = '样本标准差'
221
        ws['G6'].border = f_border
222
223
        ws['H6'].font = title_font
224
        ws['H6'].alignment = c_c_alignment
225
        ws['H6'] = '样本方差'
226
        ws['H6'].border = f_border
227
228
        # table_data
229
        for i, value in enumerate(category):
230
            row = i * 2 + 7
231
            ws['B' + str(row)].font = name_font
232
            ws['B' + str(row)].alignment = c_c_alignment
233
            ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + " )"
234
            ws['B' + str(row)].border = f_border
235
236
            ws['B' + str(row + 1)].font = name_font
237
            ws['B' + str(row + 1)].alignment = c_c_alignment
238
            ws['B' + str(row + 1)] = "环比"
239
            ws['B' + str(row + 1)].border = f_border
240
241
            ws['C' + str(row)].font = name_font
242
            ws['C' + str(row)].alignment = c_c_alignment
243
            ws['C' + str(row)] = round(reporting_period_data['means'][i], 2) \
244
                if reporting_period_data['means'][i] is not None else ''
245
            ws['C' + str(row)].border = f_border
246
247
            ws['C' + str(row + 1)].font = name_font
248
            ws['C' + str(row + 1)].alignment = c_c_alignment
249
            ws['C' + str(row + 1)] = str(round(reporting_period_data['means_increment_rate'][i] * 100, 2)) + "%" \
250
                if reporting_period_data['means_increment_rate'][i] is not None else '0.00%'
251
            ws['C' + str(row + 1)].border = f_border
252
253
            ws['D' + str(row)].font = name_font
254
            ws['D' + str(row)].alignment = c_c_alignment
255
            ws['D' + str(row)] = round(reporting_period_data['medians'][i], 2) \
256
                if reporting_period_data['medians'][i] is not None else ''
257
            ws['D' + str(row)].border = f_border
258
259
            ws['D' + str(row + 1)].font = name_font
260
            ws['D' + str(row + 1)].alignment = c_c_alignment
261
            ws['D' + str(row + 1)] = str(round(reporting_period_data['medians_increment_rate'][i] * 100, 2)) + "%" \
262
                if reporting_period_data['medians_increment_rate'][i] is not None else '0.00%'
263
            ws['D' + str(row + 1)].border = f_border
264
265
            ws['E' + str(row)].font = name_font
266
            ws['E' + str(row)].alignment = c_c_alignment
267
            ws['E' + str(row)] = round(reporting_period_data['minimums'][i], 2) \
268
                if reporting_period_data['minimums'][i] is not None else ''
269
            ws['E' + str(row)].border = f_border
270
271
            ws['E' + str(row + 1)].font = name_font
272
            ws['E' + str(row + 1)].alignment = c_c_alignment
273
            ws['E' + str(row + 1)] = str(round(reporting_period_data['minimums_increment_rate'][i] * 100, 2)) + "%" \
274
                if reporting_period_data['minimums_increment_rate'][i] is not None else '0.00%'
275
            ws['E' + str(row + 1)].border = f_border
276
277
            ws['F' + str(row)].font = name_font
278
            ws['F' + str(row)].alignment = c_c_alignment
279
            ws['F' + str(row)] = round(reporting_period_data['maximums'][i], 2) \
280
                if reporting_period_data['maximums'][i] is not None else ''
281
            ws['F' + str(row)].border = f_border
282
283
            ws['F' + str(row + 1)].font = name_font
284
            ws['F' + str(row + 1)].alignment = c_c_alignment
285
            ws['F' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \
286
                if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%'
287
            ws['F' + str(row + 1)].border = f_border
288
289
            ws['G' + str(row)].font = name_font
290
            ws['G' + str(row)].alignment = c_c_alignment
291
            ws['G' + str(row)] = round(reporting_period_data['stdevs'][i], 2) \
292
                if reporting_period_data['stdevs'][i] is not None else ''
293
            ws['G' + str(row)].border = f_border
294
295
            ws['G' + str(row + 1)].font = name_font
296
            ws['G' + str(row + 1)].alignment = c_c_alignment
297
            ws['G' + str(row + 1)] = str(round(reporting_period_data['stdevs_increment_rate'][i] * 100, 2)) + "%" \
298
                if reporting_period_data['stdevs_increment_rate'][i] is not None else '0.00%'
299
            ws['G' + str(row + 1)].border = f_border
300
301
            ws['H' + str(row)].font = name_font
302
            ws['H' + str(row)].alignment = c_c_alignment
303
            ws['H' + str(row)] = round(reporting_period_data['variances'][i], 2) \
304
                if reporting_period_data['variances'][i] is not None else ''
305
            ws['H' + str(row)].border = f_border
306
307
            ws['H' + str(row + 1)].font = name_font
308
            ws['H' + str(row + 1)].alignment = c_c_alignment
309
            ws['H' + str(row + 1)] = str(round(reporting_period_data['variances_increment_rate'][i] * 100, 2)) + "%" \
310
                if reporting_period_data['variances_increment_rate'][i] is not None else '0.00%'
311
            ws['H' + str(row + 1)].border = f_border
312
313
    #################################################
314
    # Second: 报告期消耗