Created
October 10, 2015 18:15
-
-
Save abegong/074d970531e54569dfea 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 random | |
import names | |
# http://treyhunner.com/2013/02/random-name-generator/ | |
import pandas as pd | |
k = 10 | |
gender = [random.choice(['male', 'female']) for i in range(k)] | |
users = pd.DataFrame({ | |
'id' : range(k), | |
'first_name' : [names.get_first_name(gender[i]) for i in range(k)], | |
'last_name' : [names.get_last_name() for i in range(k)], | |
'gender' : gender, | |
'age' : [random.randint(18,65) for i in range(k)] | |
}) | |
print users | |
users.to_csv('users.csv', index=None) | |
l = 20 | |
animals = ['Aardwolf', 'Addax', 'African Wild Ass', 'Ant', 'Antelope', 'Armadillo', 'Baboon', 'Badger', 'Bat', 'Bearded Dragon', 'Beetle', 'Bird', 'Black-footed Cat', 'Boa', 'Brown Bear', 'Bustard', 'Butterfly', 'Camel', 'Caracal', 'Caracara', 'Caterpillar', 'Centipede', 'Cheetah', 'Chipmunk', 'Chuckwalla', 'Climbing Mouse', 'Coati', 'Cobra', 'Cotton Rat', 'Cougar', 'Courser', 'Crane Fly', 'Crow', 'Dassie Rat', 'Dove', 'Dunnart', 'Eagle', 'Echidna', 'Elephant', 'Emu', 'Falcon', 'Fly', 'Fox', 'Frogmouth', 'Gecko', 'Gerbil', 'Grasshopper', 'Guanaco', 'Gundi', 'Hamster', 'Hawk', 'Hedgehog', 'Hyena', 'Hyrax', 'Jackal', 'Kangaroo', 'Kangaroo Rat', 'Kestrel', 'Kowari', 'Kultarr', 'Leopard', 'Lion', 'Macaw', 'Meerkat', 'Mouse', 'Oryx', 'Ostrich', 'Owl', 'Pronghorn', 'Python', 'Rabbit', 'Raccoon', 'Rattlesnake', 'Rhinoceros', 'Sand Cat', 'Spectacled Bear', 'Spiny Mouse', 'Starling', 'Stick Bug', 'Tarantula', 'Toad', 'Tortoise', 'Tyrant Flycatcher', 'Viper', 'Vulture', 'Waxwing', 'Xerus', 'Zebra', 'Boatoise', 'Chickamel', 'Cweasel', 'Dinopian', 'Doccary', 'Frider', 'Liomel', 'Owlster', 'Tabby Fox', 'Walrat'] | |
transactions = pd.DataFrame({ | |
'user_id' : [random.choice(range(k)) for i in range(l)], | |
'cost' : [round(random.uniform(1,100), 2) for i in range(l)], | |
'purchase' : [random.choice(animals) for i in range(l)], | |
}) | |
print transactions | |
transactions.to_csv('transactions.csv', index=None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment