Skip to content

Instantly share code, notes, and snippets.

@nrrb
Created November 16, 2012 05:56
Show Gist options
  • Save nrrb/4084590 to your computer and use it in GitHub Desktop.
Save nrrb/4084590 to your computer and use it in GitHub Desktop.
counting unique timestamps in skype chatlogs
import csv
import os
import glob
src_path = 'C:\\Users\\Nick\\Dropbox\\MTS Relational Event Network Modeling\\MTS Data\\NU Newest Chatlogs\\Deduplicated Logs By Phase'
for filename in glob.glob(os.path.join(src_path, "*.txt")):
with open(filename, 'rb') as f:
rows = list(csv.reader(f, delimiter='\t'))
event_count = len(rows)
unique_timestamp_count = len(list(set([row[3] for row in rows if len(row) > 3])))
print filename.split('\\')[-1], event_count, unique_timestamp_count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment