Created
December 1, 2015 18:58
-
-
Save jpotts18/64acd60e11355fe28292 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 uuid, random, json | |
# json.dumps(x, indent=4) | |
product_range = range(100000,110000) | |
num_recs_per_type = 20 | |
num_users = 500000 | |
user_ids = [ str(uuid.uuid1()) for _ in range(num_users) ] | |
rec_types = ['by_x','by_y','by_z'] | |
user_recs = [] | |
for _ in xrange(num_users): | |
user_recs.append( | |
{ "user_guid": str(uuid.uuid1()), | |
"recommendations" : { r :random.sample(product_range, num_recs_per_type) for r in rec_types }}) | |
with open('user-recs-' + str(num_users) + '-users.json', 'wb') as f: | |
f.write(json.dumps(user_recs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment