Home > other >  Novice consult a great god: how Python statistics list each numerical respectively first visit there
Novice consult a great god: how Python statistics list each numerical respectively first visit there

Time:01-30

Example: list is,3,2,1,1,3 [2]
How to achieve the results for {2:1, 3:1, 2:2, 1:1, 1:2, 3:2}

CodePudding user response:

In the Window. PartitionBy

CodePudding user response:

 LST=,3,2,1,1,3 [2] 

A=[]
B={}
For x in LST:
B=b [x] [x] + 1 if b.g et (x) the else 1
A.a ppend ((x, (b [x] if b.g et 1) (x) the else))
Print (a)
  • Related