I have three arrays as below:
users - contains the identifier of 50,000 users (all different)pusers - contains the identifier of users who own some messages (also contains a duplicate identifier, that is, one user can own many messages) [50,000 values]score- Contains a score corresponding to each value in pusers. [50,000 values]
Now I want to populate another array PScorebased on the following calculation. For each value usersin pusersI need to get the corresponding one scoreand add it to the array PScorein the index corresponding user.
Example
if users[5] = 23224
and pusers[6] = pusers[97] = 23224
then PScore[5] += score[6]+score[97]
Notes:
scoreRefers to pusers(e.g., pusers[5]has score[5]) It is expected thatPScore users (, users[5] Pscore[5])- , , .
- , ,
score 0.
- ? , , , Ctrl+Z .
, .
, Python. .
- , StackOverflow.
- Orange, .
, , - . ? -, , , ?
, , .
PUsers Score
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
13 0
77 1
77 4
77 3
77 0
77 2
77 2
77 3
102 2
105 0
108 2
108 2
117 2
Users
-1
1
2
3
4
5
8
9
10
11
13
16
17
19
20
22
23
24
25
26
27
29
30
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
48
49
50
, , , . , pusers , . , , , , PScore[6], , User[6].
, .
.