Commit 5a6668d5 authored by Markus Schedl's avatar Markus Schedl
Browse files

cleaned further

parent 92e3db53
...@@ -65,9 +65,9 @@ OPTICS_MIN_CLUSTER_SIZE = 3 # Minimum number of data points per cluster ...@@ -65,9 +65,9 @@ OPTICS_MIN_CLUSTER_SIZE = 3 # Minimum number of data points per cluster
# Read file fn containing pairs of tracks and listening events # Read file fn containing pairs of tracks and listening events
def read_tracks_le(fn): def read_tracks_le(fn):
track_le = {} track_le = {}
# no_lines = sum(1 for line in open(fn, 'r')) # no_lines = sum(1 for line in open(fn, 'r'))
# no_lines = len(open(fn).read().splitlines()) # no_lines = len(open(fn).read().splitlines())
# print(no_lines) # print(no_lines)
counter = 0 counter = 0
with open(fn, 'r') as f: with open(fn, 'r') as f:
for line in f: for line in f:
...@@ -93,15 +93,15 @@ def read_country_number_users(fn): ...@@ -93,15 +93,15 @@ def read_country_number_users(fn):
country = content[0] country = content[0]
# Parse lines # Parse lines
uid_les_all = content[1].split(';') uid_les_all = content[1].split(';')
# print('Number of users for country %s: %d' % (content[0], len(uid_les_all))) # print('Number of users for country %s: %d' % (content[0], len(uid_les_all)))
country_users[country] = len(uid_les_all)-1 country_users[country] = len(uid_les_all)-1
for idx_uid_les in range(0, len(uid_les_all) - 1): # All users in current country for idx_uid_les in range(0, len(uid_les_all) - 1): # All users in current country
uid_les = uid_les_all[idx_uid_les] uid_les = uid_les_all[idx_uid_les]
# print(uid_les) # print(uid_les)
uid_les_split = uid_les.split(' ') uid_les_split = uid_les.split(' ')
uid = np.int32(uid_les_split[0]) uid = np.int32(uid_les_split[0])
les = np.int32(uid_les_split[1]) les = np.int32(uid_les_split[1])
# print(uid, les) # print(uid, les)
else: else:
print('Problem encountered with ', content) print('Problem encountered with ', content)
if np.mod(counter, 100000) == 0: if np.mod(counter, 100000) == 0:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment