Created
June 11, 2014 08:50
-
-
Save lukashavrlant/c11ca09ba2e257a82362 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from glob import glob | |
from os.path import join | |
ID_SERVER = 0 | |
ID_SECTION = 1 | |
ID_PLACEMENT = 2 | |
BANNER_TYPE = 3 | |
UUID_INDEX = 27 | |
users = dict() | |
for path in glob(join(sys.argv[1], '*.csv')): | |
with open(path) as f: | |
for line in f: | |
arr = line.split("\t") | |
if arr[UUID_INDEX] != "0": | |
if users.get(arr[ID_SERVER], False): | |
users[arr[ID_SERVER]].add(arr[UUID_INDEX]) | |
else: | |
users[arr[ID_SERVER]] = set([UUID_INDEX]) | |
for k, v in users.items(): | |
print "SERVER_ID: %s, cardinality: %s" % (k, len(v)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment