统计人数
This commit is contained in:
parent
be74900fc7
commit
46dc4d55f6
@ -0,0 +1,36 @@
|
||||
import json
|
||||
import csv
|
||||
from island.matches import Matches
|
||||
|
||||
user_data = {} # user_id => {m => match_count, s => total_score, d => {match_id => score}}
|
||||
|
||||
ms = Matches('wos-data-2022-12-16')
|
||||
for m in ms.data:
|
||||
game_end_at = int(m.query('game', 'created').first()['info']['game_end_at'])
|
||||
for r in m.query('user', 'fitness').raw_data:
|
||||
if r['user'] not in user_data:
|
||||
user_data[r['user']] = dict(m=0, s=0, d={})
|
||||
user_data[r['user']]['m'] += 1
|
||||
user_data[r['user']]['s'] += float(r['fitness']) / game_end_at
|
||||
|
||||
match_bonus = {'炎儒': {'vote': 24, 'bonus': '106.67'}, 'linhaha': {'vote': 15, 'bonus': '66.67'}, '樊欣': {'vote': 10, 'bonus': '44.44'}, 'z': {'vote': 9, 'bonus': '40.00'}, '乖乖': {'vote': 36, 'bonus': '160.00'}, 'CHYK': {'vote': 27, 'bonus': '120.00'}, '赵子截江夺阿斗': {'vote': 24, 'bonus': '106.67'}, '海丽可可': {'vote': 12, 'bonus': '53.33'}, 'gwb': {'vote': 28, 'bonus': '124.44'}, 'Lee.h': {'vote': 13, 'bonus': '57.78'}, 'Yao': {'vote': 12, 'bonus': '53.33'}, 'zmw': {'vote': 15, 'bonus': '66.67'}}
|
||||
|
||||
print('username\tvote\tbonus')
|
||||
for k, v in match_bonus.items():
|
||||
print(f"{k}\t{v['vote']}\t{v['bonus']}")
|
||||
|
||||
total = 0
|
||||
print('\t'.join(('UID', 'Bonus', 'username', 'email')))
|
||||
with open('username.csv', 'r', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
parts = line.strip().split(',')
|
||||
uid = int(parts[0])
|
||||
if uid in user_data:
|
||||
bonus = user_data[uid]['s']
|
||||
if parts[1] in match_bonus:
|
||||
bonus += float(match_bonus[parts[1]]['bonus'])
|
||||
parts.insert(1, '%.2f' % bonus)
|
||||
total += bonus
|
||||
print('\t'.join(parts))
|
||||
|
||||
print(f'total={total:.2f}')
|
||||
BIN
new-cr.zip
Normal file
BIN
new-cr.zip
Normal file
Binary file not shown.
1
outputs/CR_G1196.csv
Normal file
1
outputs/CR_G1196.csv
Normal file
@ -0,0 +1 @@
|
||||
0.95,0.9166666666666666,0.8571428571428571,0.6666666666666666,0.6798245614035089,0.75,0.8070175438596491,0.631578947368421,0.675,0.5833333333333333,0.7,0.5416666666666667,0.4629629629629629
|
||||
|
1
outputs/CR_G1214.csv
Normal file
1
outputs/CR_G1214.csv
Normal file
@ -0,0 +1 @@
|
||||
0.967741935483871,0.9482758620689655,0.8548387096774194,0.8548387096774194,0.7722222222222223,0.7962962962962962,0.8456790123456791,0.5689655172413793,0.52,0.52,0.5229885057471264,0.5454545454545454,0.4482758620689655,0.37037037037037035,0.45,0.5185185185185185
|
||||
|
1
outputs/CR_G1224.csv
Normal file
1
outputs/CR_G1224.csv
Normal file
@ -0,0 +1 @@
|
||||
0.8484848484848485,0.8081738437001595,0.7702380952380952,0.7076680672268908,0.6524130190796859,0.6718574635241301,0.6270089285714285,0.5479500891265596,0.5397058823529413,0.42705415499533145,0.36888634241575413,0.4080467372134039,0.41712580348943984
|
||||
|
1
outputs/CR_G1228.csv
Normal file
1
outputs/CR_G1228.csv
Normal file
@ -0,0 +1 @@
|
||||
0.821577380952381,0.8177777777777777,0.7674876847290641,0.7713492063492065,0.7402380952380953,0.7208333333333332,0.672936507936508,0.6041871921182265,0.5409688013136289,0.46706349206349207,0.4437301587301587,0.412063492063492,0.24139784946236562
|
||||
|
1
outputs/CR_G1230.csv
Normal file
1
outputs/CR_G1230.csv
Normal file
@ -0,0 +1 @@
|
||||
0.7714285714285715,0.6874999999999999,0.6677083333333332,0.6918402777777778,0.6776041666666667,0.6235449735449735,0.6466931216931218,0.5865079365079365,0.6075396825396826,0.5503968253968254,0.4083333333333333,0.29166666666666663,0.18055555555555552,0.13518518518518519,0.05185185185185184,0.05654761904761905
|
||||
|
1
outputs/CR_G1234.csv
Normal file
1
outputs/CR_G1234.csv
Normal file
@ -0,0 +1 @@
|
||||
0.9333333333333332,0.8916666666666666,0.8775000000000001,0.7964912280701754,0.8148809523809526,0.8882352941176471,0.8018518518518518,0.7175438596491228,0.7735294117647059,0.5372180451127819,0.47857142857142854,0.5706349206349207,0.4657894736842106,0.4009803921568627,0.3935185185185185
|
||||
|
1
outputs/CR_G916.csv
Normal file
1
outputs/CR_G916.csv
Normal file
@ -0,0 +1 @@
|
||||
0.9516666666666667,0.8694444444444446,0.8660714285714286,0.8505747126436781,0.8630952380952381,0.8392857142857143,0.8448275862068966,0.8846153846153846,0.9022988505747127,0.896551724137931,0.8392857142857143,0.7976190476190477,0.7820512820512822,0.8154761904761906,0.8392857142857143,0.6481481481481481,0.7133333333333333,0.82
|
||||
|
1
outputs/CR_G927.csv
Normal file
1
outputs/CR_G927.csv
Normal file
@ -0,0 +1 @@
|
||||
1.0,0.8823529411764706,0.7719298245614036,0.875,0.8235294117647058,0.875,0.8235294117647058,0.8529411764705882,0.875,0.8055555555555556,0.7352941176470589,0.75,0.8627450980392157,0.6842105263157895,0.7941176470588235,0.7982456140350878,0.8425925925925926,0.7745098039215687,0.8125,0.78125,0.6388888888888888,0.8125,0.712962962962963,0.7352941176470589,0.7058823529411765,0.8
|
||||
|
1
outputs/CR_G933.csv
Normal file
1
outputs/CR_G933.csv
Normal file
@ -0,0 +1 @@
|
||||
0.984126984126984,0.9444444444444444,0.9473684210526315,0.9210526315789473,0.9166666666666667,0.8947368421052632,0.85,0.7592592592592593,0.9074074074074073,0.9122807017543859,0.85,0.9444444444444444,0.8518518518518517,0.8666666666666668,0.85,0.824074074074074,0.7583333333333334,0.823529411764706,0.7037037037037037,0.7631578947368421,0.5648148148148148,0.6759259259259259,0.5964912280701754,0.6078431372549019,0.5882352941176471,0.6333333333333333,0.7368421052631579,0.5092592592592593
|
||||
|
1
outputs/CR_G936.csv
Normal file
1
outputs/CR_G936.csv
Normal file
@ -0,0 +1 @@
|
||||
0.9298245614035087,0.7850877192982457,0.8201754385964911,0.8728070175438598,0.868421052631579,0.868421052631579,0.8333333333333334,0.8703703703703703,0.8148148148148148,0.8529411764705882,0.8611111111111112,0.8111111111111111,0.75,0.78125,0.8125,0.8235294117647058,0.7142857142857143,0.6666666666666666,0.78125,0.7407407407407407,0.7777777777777778,0.5555555555555556,0.5,0.5555555555555556
|
||||
|
1
outputs/CR_G937.csv
Normal file
1
outputs/CR_G937.csv
Normal file
@ -0,0 +1 @@
|
||||
0.7857142857142857,0.6666666666666666,0.8571428571428571,0.8333333333333334,0.7857142857142857,0.8823529411764706,0.8235294117647058,0.8823529411764706,0.875,0.8571428571428571
|
||||
|
1
outputs/CR_G943.csv
Normal file
1
outputs/CR_G943.csv
Normal file
@ -0,0 +1 @@
|
||||
0.7727272727272727,0.6923076923076923,0.8181818181818182,0.8181818181818182,0.8333333333333334,0.9166666666666666,0.8333333333333334,0.8333333333333334,0.8333333333333334,0.8
|
||||
|
1
outputs/CR_G945.csv
Normal file
1
outputs/CR_G945.csv
Normal file
@ -0,0 +1 @@
|
||||
0.8888888888888888,0.625,0.6666666666666666,0.8571428571428571,0.8333333333333334,0.7222222222222222,0.8333333333333334,0.7777777777777778,0.7222222222222222,0.5,0.5555555555555556,0.6666666666666666,0.8125,0.8571428571428571,0.75,0.9285714285714286,0.6666666666666666,0.7222222222222222,0.7222222222222222,0.7222222222222222,0.8571428571428571,0.7222222222222222,0.8333333333333334,0.6666666666666666,0.7222222222222222
|
||||
|
1
outputs/S_R.json
Normal file
1
outputs/S_R.json
Normal file
@ -0,0 +1 @@
|
||||
{"G1142": [34426, 28120, 25362, 24882, 22618, 29516, 27658, 34040, 33962, 35278, 29500, 35878, 37218, 39028], "G1156": [45318, 39460, 38398, 40288, 40040, 36340, 42912, 32462, 39430, 40200, 47320, 50474, 40080, 44960], "G1162": [25354, 23696, 27340, 32116, 33962, 34360, 35044, 29578, 36996, 35316, 42500, 37896, 39078, 36540, 46714, 46374], "G1196": [15324, 11700, 9080, 10798, 14126, 18718, 10800, 10798, 8758, 14402, 9360, 12240, 9360], "G1214": [18798, 20000, 15280, 12960, 15840, 16560, 17280, 16800, 19440, 25200, 16320, 23760, 14400, 18720, 13440, 16560], "G646": [39356, 34502, 32800, 26040, 23254, 24304, 27738, 30302, 24214, 25520, 23042], "G903": [24212, 17440, 19098, 18234, 18002, 15918, 20240, 21110, 17320, 16900, 20890, 18824, 19128, 18000, 19922, 18698, 15982, 22778, 18158, 21840, 20040, 20438, 21998, 21282, 23358, 21600, 26156, 23742], "G933": [7186, 11766, 9360, 8640, 7200, 6480, 6480, 8640, 10080, 8640, 5760, 8640, 8640, 6480, 5040, 8640, 5760, 9360, 10080, 7200, 8640, 9360, 5760, 10440, 9360, 5280, 9118, 7920], "G936": [15822, 13280, 8680, 7920, 8000, 6480, 7200, 8280, 10960, 9360, 7920, 12040, 11240, 13400, 12240, 11040, 14162, 8800, 10800, 10080, 9200, 8640, 8840, 11400], "G945": [1440, 2880, 1440, 2880, 1480, 1440, 1440, 1440, 0, 1440, 1440, 1440, 2880, 2880, 2880, 2880, 1440, 1440, 1440, 0, 2880, 1440, 2160, 1440, 1440], "G975": [68626, 71856, 65178, 59276, 60228, 55882, 55324, 56476, 54730, 46612, 44640, 56722, 57358]}
|
||||
51
season bonus.txt
Normal file
51
season bonus.txt
Normal file
@ -0,0 +1,51 @@
|
||||
UID Bonus username email
|
||||
458 55.44 樊欣 fx17326023411@163.com
|
||||
476 119.36 linhaha gguanglin@126.com
|
||||
450 147.17 炎儒 lxq_0327@126.com
|
||||
261 3.58 drmoody 1924530647@qq.com
|
||||
561 214.51 乖乖 1737019369@qq.com
|
||||
428 14.92 007 1757634785@qq.com
|
||||
562 10.31 andrewem 3275284157@qq.com
|
||||
566 0.64 mopai 15014221@qq.com
|
||||
493 11.94 pomegranateee 719348146@qq.com
|
||||
568 7.85 究极摆烂王 1065112771@qq.com
|
||||
557 3.39 咕咕咕咕 1049222549@qq.com
|
||||
555 84.19 Lee.h 2230760@tongji.edu.cn
|
||||
559 96.82 Yao yao_zy@outlook.com
|
||||
564 26.42 aaaa 994746576@qq.com
|
||||
481 1.39 Arthur shenhan@live.cn
|
||||
446 8.71 Latte 843634544@qq.com
|
||||
451 98.40 海丽可可 610092133@qq.com
|
||||
473 19.30 fyl yuliang_fu@163.com
|
||||
469 7.07 ling 2858529135@qq.com
|
||||
558 104.78 zmw 2296203694@qq.com
|
||||
489 27.92 J 564669383@qq.com
|
||||
480 28.62 Here orange_xy_bill@163.com
|
||||
472 33.38 sun xly0506@163.com
|
||||
503 3.79 White55k ce_hzx@163.com
|
||||
467 16.20 lucky 919917423@qq.com
|
||||
511 165.16 赵子截江夺阿斗 1667519588@qq.com
|
||||
509 7.69 lxd 1256221608@qq.com
|
||||
468 3.08 maybe 15033562889@163.com
|
||||
265 0.96 小芋头 1725486855@qq.com
|
||||
515 22.16 朱晨虹 zhuchenhong1995@163.com
|
||||
255 45.68 gly admin@sw.local
|
||||
78 53.30 报丧鸟 yichaozhang@tongji.edu.cn
|
||||
463 190.56 gwb gwb0521@163.com
|
||||
460 167.82 CHYK 375884250@qq.com
|
||||
54 25.77 陈某某 1652239@tongji.edu.cn
|
||||
453 5.83 俺是农村的 lds2000better@163.com
|
||||
452 23.89 房肖 fx_ysu@163.com
|
||||
454 41.96 xiong xiong_ziyue@163.com
|
||||
457 0.52 zy 1264191616@qq.com
|
||||
449 34.65 骆哲鑫 731812428@qq.com
|
||||
485 13.73 刘沐易 1119136943@qq.com
|
||||
565 13.83 陈 1109067315@qq.com
|
||||
560 0.70 香蕉吃鱼 1655154608@qq.com
|
||||
563 0.00 seu龙的传人 220201676@seu.edu.cn
|
||||
496 57.71 z zhan_yongliang@163.com
|
||||
556 26.16 luxiao lx199802282829@163.com
|
||||
507 11.60 alw 1263019438@qq.com
|
||||
359 10.57 雷神的小锤子 3327078581@qq.com
|
||||
408 21.64 Prime 383942863@qq.com
|
||||
total=2091.08
|
||||
26
wos-data-2022-12-16/query.py
Normal file
26
wos-data-2022-12-16/query.py
Normal file
@ -0,0 +1,26 @@
|
||||
import pandas as pd
|
||||
|
||||
df = pd.read_excel('result.xlsx')
|
||||
row_count = len(df)
|
||||
|
||||
counts = df.iloc[:, 4:22].apply(pd.value_counts).fillna(0).loc['👍']
|
||||
users = {}
|
||||
|
||||
with open('result.txt', encoding='utf-8') as f:
|
||||
idx = 0
|
||||
username = ''
|
||||
for line in f:
|
||||
if line.startswith('玩家:'):
|
||||
username = line.strip().split(' ')[1]
|
||||
users[username] = dict(vote=0, bonus=0.0)
|
||||
if line.startswith('在第') and line.strip().endswith('场比赛中获胜'):
|
||||
print(df.columns[idx+4])
|
||||
users[username]['vote'] += counts[idx]
|
||||
idx += 1
|
||||
|
||||
print(row_count)
|
||||
|
||||
for k, v in users.items():
|
||||
users[k]['bonus'] = f"{v['vote'] / counts.sum() * 1000:.2f}"
|
||||
|
||||
print(users)
|
||||
BIN
wos-data-2022-12-16/result.xlsx
Normal file
BIN
wos-data-2022-12-16/result.xlsx
Normal file
Binary file not shown.
BIN
wos-data-sanitized.zip
Normal file
BIN
wos-data-sanitized.zip
Normal file
Binary file not shown.
BIN
wos-data.zip
Normal file
BIN
wos-data.zip
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user