This page is in community mode. Any user with 100 rep may edit it.
  • Last edited on Feb 3, 2017, 7:51:08 PM by 674039 wim
  • Edit

Code to get Rep:Answer ratio and the results, will upgrade to a full report later.

Cabbage,

Fizzy.

         answer_count            display_name  reputation       ratio
user_id                                                              
893              5390            Greg Hewgill      531950   98.692022
100297          16866         Martijn Pieters      528455   31.332563
95810            6329           Alex Martelli      497170   78.554274
20862           11976  Ignacio Vazquez-Abrams      463255   38.681947
190597           6841                  unutbu      404480   59.125859
104349           9275          Daniel Roseman      338852   36.533908
10661            3902                  S.Lott      269569   69.084828
9951              487                 e-satis      263520  541.108830
279627           2215            Sven Marnach      237069  107.028894
771848           7953                  alecxe      235909   29.662895
20670            4146           Tim Pietzcker      202982   48.958514
4279             4471          J.F. Sebastian      191639   42.862671
14343            2522          Ned Batchelder      186146   73.808882
908494           4790                abarnert      171352   35.772860
748858           3889                 mgilson      162571   41.802777
174728           3614            John La Rooy      159771   44.208910
216074           2606                    poke      137431   52.736378
846892           3675       Ashwini Chaudhary      136805   37.225850
487339           2198                     DSM      136358   62.037307
12855            1009             SilentGhost      134079  132.883053
325565           1052             Joe Kington      127905  121.582700
1903116          2968            thefourtheye      124392   41.911051
2141635          5141      Padraic Cunningham      113150   22.009337
3293881          2823                 Divakar       88542   31.364506
674039           1588                     wim       87654   55.197733
1001643          1212       Raymond Hettinger       86540   71.402640
2357112          2417             user2357112       85264   35.276789
1252759          2103            Jon Clements       76442   36.349025
1426065          1474                 MattDMo       56990   38.663501
1578604          1669                   Jerry       50017   29.968244
918959           1238           Antti Haapala       46385   37.467690
953482           1353                   Kevin       44628   32.984479
1333975           667                   Ahmad       37467   56.172414
400617            951                davidism       37050   38.958991
2617068          1523             TigerhawkT3       35341   23.204859
1971805           881                  TerryA       33148   37.625426
1624921           569          Games Brainiac       29076   51.100176
2705542           501              Tim Peters       27833   55.554890
4099593           548             Bhargav Rao       24618   44.923358
4014959          1082                PM 2Ring       23328   21.560074
344286            630            Wayne Werner       20821   33.049206
2301450           425                 vaultah       20589   48.444706
1014938           332            Zero Piraeus       19261   58.015060
3005188           352               Ffisegydd       17422   49.494318
2063361           959        Moinuddin Quadri       16250   16.944734
5067311           379             Andras Deak       12809   33.796834
1832539           441                   idjaw       11776   26.702948
1773904           188               Ian Clark        6353   33.792553
3059812           159           Morgan Thrapp        5934   37.320755
2188562            95              Peter Varo        5424   57.094737
61938             119            Robert Grant        4914   41.294118
1150599           165                  corvid        3893   23.593939
1241495            15            IntrepidBrit         780   52.000000
1946923             2                Marcus S         211  105.500000


                   display_name       ratio
user_id                                    
9951                    e-satis  541.108830
12855               SilentGhost  132.883053
325565              Joe Kington  121.582700
279627             Sven Marnach  107.028894
1946923                Marcus S  105.500000
893                Greg Hewgill   98.692022
95810             Alex Martelli   78.554274
14343            Ned Batchelder   73.808882
1001643       Raymond Hettinger   71.402640
10661                    S.Lott   69.084828
487339                      DSM   62.037307
190597                   unutbu   59.125859
1014938            Zero Piraeus   58.015060
2188562              Peter Varo   57.094737
1333975                   Ahmad   56.172414
2705542              Tim Peters   55.554890
674039                      wim   55.197733
216074                     poke   52.736378
1241495            IntrepidBrit   52.000000
1624921          Games Brainiac   51.100176
3005188               Ffisegydd   49.494318
20670             Tim Pietzcker   48.958514
2301450                 vaultah   48.444706
4099593             Bhargav Rao   44.923358
174728             John La Rooy   44.208910
4279             J.F. Sebastian   42.862671
1903116            thefourtheye   41.911051
748858                  mgilson   41.802777
61938              Robert Grant   41.294118
400617                 davidism   38.958991
20862    Ignacio Vazquez-Abrams   38.681947
1426065                 MattDMo   38.663501
1971805                  TerryA   37.625426
918959            Antti Haapala   37.467690
3059812           Morgan Thrapp   37.320755
846892        Ashwini Chaudhary   37.225850
104349           Daniel Roseman   36.533908
1252759            Jon Clements   36.349025
908494                 abarnert   35.772860
2357112             user2357112   35.276789
5067311             Andras Deak   33.796834
1773904               Ian Clark   33.792553
344286             Wayne Werner   33.049206
953482                    Kevin   32.984479
3293881                 Divakar   31.364506
100297          Martijn Pieters   31.332563
1578604                   Jerry   29.968244
771848                   alecxe   29.662895
1832539                   idjaw   26.702948
1150599                  corvid   23.593939
2617068             TigerhawkT3   23.204859
2141635      Padraic Cunningham   22.009337
4014959                PM 2Ring   21.560074
2063361        Moinuddin Quadri   16.944734
import pandas as pd
import requests
import json


users = {
    893: 'Greg Hewgill',
    4279: 'J.F. Sebastian',
    9951: 'e-satis',
    10661: 'S.Lott',
    12855: 'SilentGhost',
    14343: 'Ned Batchelder',
    20670: 'Tim Pietzcker',
    20862: 'Ignacio Vazquez-Abrams',
    61938: 'Robert Grant',
    95810: 'Alex Martelli',
    100297: 'Martijn Pieters',
    104349: 'Daniel Roseman',
    174728: 'John La Rooy',
    190597: 'unutbu',
    216074: 'poke',
    279627: 'Sven Marnach',
    325565: 'Joe Kington',
    344286: 'Wayne Werner',
    400617: 'davidism',
    487339: 'DSM',
    674039: 'wim',
    748858: 'mgilson',
    771848: 'alecxe',
    846892: 'Ashwini Chaudhary',
    908494: 'abarnert',
    918959: 'Antti Haapala',
    953482: 'Kevin',
    1001643: 'Raymond Hettinger',
    1014938: 'Zero Piraeus',
    1150599: 'corvid',
    1241495: 'IntrepidBrit',
    1252759: 'Jon Clements',
    1333975: 'Ahmad',
    1426065: 'MattDMo',
    1578604: 'Jerry',
    1624921: 'Games Brainiac',
    1773904: 'Ian Clark',
    1832539: 'idjaw',
    1903116: 'thefourtheye',
    1946923: 'Marcus S',
    1971805: 'TerryA',
    2063361: 'Moinuddin Quadri',
    2141635: 'Padraic Cunningham',
    2188562: 'Peter Varo',
    2301450: 'vaultah',
    2357112: 'user2357112',
    2617068: 'TigerhawkT3',
    2705542: 'Tim Peters',
    3005188: 'Ffisegydd',
    3059812: 'Morgan Thrapp',
    3293881: 'Divakar',
    4014959: 'PM 2Ring',
    4099593: 'Bhargav Rao',
    5067311: 'Andras Deak',
}

query = {
    "order": 'desc',
    "sort": 'reputation',
    "site": 'stackoverflow',
    "filter": '!qGQfoR5n.F)O1rEoua(e',  # fields: answer_count, display_name, reputation, user_id
    "pagesize": 100,
}

user_ids = ';'.join(map(str, users))
api_url = 'https://api.stackexchange.com/2.2/users/'
response = requests.get(api_url + user_ids, data=query)

if response.status_code != 200:
    print(response.text)
    raise Exception

data = json.loads(response.text)

if data.get('has_more'):
    # Wanted to send more than `pagesize` user_ids?  
    # You'll have to implement the pagination.
    print('WARNING: some data loss')

df = pd.DataFrame(data['items'])
df.index = df['user_id']
del df['user_id']
df['ratio'] = df['reputation'] / df['answer_count']

print(df)
print('\n')
print(df[['display_name', 'ratio']].sort_values(by='ratio', ascending=False))