User Tools

Site Tools


ranker

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ranker [2016/10/07 15:54] (current)
vincenzo created
Line 1: Line 1:
 +<code python>
 +# ranker function
 +def ranker(df):
 +    df['​rank'​] = np.arange(len(df)) + 1
 +    return df
  
 +# apply rank
 +df = df.groupby(['​ip'​]).apply(ranker)
 +</​code>​
ranker.txt ยท Last modified: 2016/10/07 15:54 by vincenzo