Best Python code snippet using hypothesis
test_random.py
Source:test_random.py  
...593            np.testing.assert_array_almost_equal(out1, out2)594        else:595            np.testing.assert_array_equal(out1, out2)596    def test_normal(self):597        def gen_random(state, out):598            out[...] = state.normal(size=10000)599        self.check_function(gen_random, sz=(10000,))600    def test_exp(self):601        def gen_random(state, out):602            out[...] = state.exponential(scale=np.ones((100, 1000)))603        self.check_function(gen_random, sz=(100, 1000))604    def test_multinomial(self):605        def gen_random(state, out):606            out[...] = state.multinomial(10, [1/6.]*6, size=10000)607        self.check_function(gen_random, sz=(10000,6))608if __name__ == "__main__":...create_crime_data_csv.py
Source:create_crime_data_csv.py  
1############ create crime data as csv ############2import random3# create file4f = open("crime_data.csv", "w")5# save label6f.write("Type" + ", " + "Date-Time" + ", " + "Latitude" + ", " + "Longitude" + "\n")7############################# random #############################8# create Theft data (1050)9for i in range(2, 1052):10    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))11    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))12    f.write("Theft" + ", " + 13    str(date) + " " + str(time) + ", " + 14    str(random.uniform(37.5546645, 37.56886886)) + ", " + 15    str(random.uniform(126.96777894, 127.0176931)) + "\n")16# create Assault data (950)17for i in range(1052, 2002):18    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))19    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))20    21    f.write("Assault" + ", " + 22    str(date) + " " + str(time) + ", " + 23    str(random.uniform(37.5546645, 37.56886886)) + ", " + 24    str(random.uniform(126.96777894, 127.0176931)) + "\n")25# create Sexaul Harassment data (100)26for i in range(2002, 2102):27    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))28    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))29    30    f.write("Sexaul Harassment" + ", " + 31    str(date) + " " + str(time) + ", " + 32    str(random.uniform(37.5546645, 37.56886886)) + ", " + 33    str(random.uniform(126.96777894, 127.0176931)) + "\n")34############################# 2 #############################35# create Theft data (180)36for i in range(0, 180):37    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))38    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))39    f.write("Theft" + ", " + 40    str(date) + " " + str(time) + ", " + 41    str(random.uniform(37.5492475, 37.5545530)) + ", " + 42    str(random.uniform(126.9916576, 127.0143248)) + "\n")43# create Assault data (160)44for i in range(0, 160):45    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))46    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))47    48    f.write("Assault" + ", " + 49    str(date) + " " + str(time) + ", " + 50    str(random.uniform(37.5492475, 37.5545530)) + ", " + 51    str(random.uniform(126.9916576, 127.0143248)) + "\n")52# create Sexual Harassment data (20)53for i in range(0, 20):54    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))55    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))56    57    f.write("Sexaul Harassment" + ", " + 58    str(date) + " " + str(time) + ", " + 59    str(random.uniform(37.5492475, 37.5545530)) + ", " + 60    str(random.uniform(126.9916576, 127.0143248)) + "\n")61############################# 3 #############################62# create Theft data (115)63for i in range(0, 115):64    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))65    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))66    f.write("Theft" + ", " + 67    str(date) + " " + str(time) + ", " + 68    str(random.uniform(37.5573879, 37.5708829)) + ", " + 69    str(random.uniform(127.0175972, 127.0233386)) + "\n")70# create Assault data (100)71for i in range(0, 100):72    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))73    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))74    75    f.write("Assault" + ", " + 76    str(date) + " " + str(time) + ", " + 77    str(random.uniform(37.5573879, 37.5708829)) + ", " + 78    str(random.uniform(127.0175972, 127.0233386)) + "\n")79# create Sexual Harassment data (15)80for i in range(0, 15):81    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))82    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))83    84    f.write("Sexaul Harassment" + ", " + 85    str(date) + " " + str(time) + ", " + 86    str(random.uniform(37.5573879, 37.5708829)) + ", " + 87    str(random.uniform(127.0175972, 127.0233386)) + "\n")88############################# 4 #############################89# create Theft data (45)90for i in range(0, 45):91    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))92    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))93    f.write("Theft" + ", " + 94    str(date) + " " + str(time) + ", " + 95    str(random.uniform(37.5544505, 37.5598302)) + ", " + 96    str(random.uniform(126.9621857, 126.9678786)) + "\n")97# create Assault data (40)98for i in range(0, 40):99    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))100    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))101    102    f.write("Assault" + ", " + 103    str(date) + " " + str(time) + ", " + 104    str(random.uniform(37.5544505, 37.5598302)) + ", " + 105    str(random.uniform(126.9621857, 126.9678786)) + "\n")106# create Sexual Harassment data (5)107for i in range(0, 5):108    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))109    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))110    111    f.write("Sexaul Harassment" + ", " + 112    str(date) + " " + str(time) + ", " + 113    str(random.uniform(37.5544505, 37.5598302)) + ", " + 114    str(random.uniform(126.9621857, 126.9678786)) + "\n")115############################# 5 #############################116# create Theft data (36)117for i in range(0, 36):118    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))119    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))120    f.write("Theft" + ", " + 121    str(date) + " " + str(time) + ", " + 122    str(random.uniform(37.5438144, 37.5492054)) + ", " + 123    str(random.uniform(127.0052766, 127.0098404)) + "\n")124# create Assault data (32)125for i in range(0, 32):126    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))127    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))128    129    f.write("Assault" + ", " + 130    str(date) + " " + str(time) + ", " + 131    str(random.uniform(37.5438144, 37.5492054)) + ", " + 132    str(random.uniform(127.0052766, 127.0098404)) + "\n")133# create Sexual Harassment data (4)134for i in range(0, 4):135    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))136    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))137    138    f.write("Sexaul Harassment" + ", " + 139    str(date) + " " + str(time) + ", " + 140    str(random.uniform(37.5438144, 37.5492054)) + ", " + 141    str(random.uniform(127.0052766, 127.0098404)) + "\n")142############################# 6 #############################143# create Theft data (30)144for i in range(0, 30):145    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))146    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))147    f.write("Theft" + ", " + 148    str(date) + " " + str(time) + ", " + 149    str(random.uniform(37.5509521, 37.5545297)) + ", " + 150    str(random.uniform(126.9859963, 126.9916777)) + "\n")151# create Assault data (27)152for i in range(0, 27):153    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))154    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))155    156    f.write("Assault" + ", " + 157    str(date) + " " + str(time) + ", " + 158    str(random.uniform(37.5509521, 37.5545297)) + ", " + 159    str(random.uniform(126.9859963, 126.9916777)) + "\n")160# create Sexual Harassment data (3)161for i in range(0, 3):162    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))163    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))164    165    f.write("Sexaul Harassment" + ", " + 166    str(date) + " " + str(time) + ", " + 167    str(random.uniform(37.5509521, 37.5545297)) + ", " + 168    str(random.uniform(126.9859963, 126.9916777)) + "\n")169############################# 7 #############################170# create Theft data (33)171for i in range(0, 33):172    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))173    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))174    f.write("Theft" + ", " + 175    str(date) + " " + str(time) + ", " + 176    str(random.uniform(37.5527263, 37.5544725)) + ", " + 177    str(random.uniform(126.9735413, 126.9860058)) + "\n")178# create Assault data (29)179for i in range(0, 29):180    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))181    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))182    183    f.write("Assault" + ", " + 184    str(date) + " " + str(time) + ", " + 185    str(random.uniform(37.5527263, 37.5544725)) + ", " + 186    str(random.uniform(126.9735413, 126.9860058)) + "\n")187# create Sexual Harassment data (4)188for i in range(0, 4):189    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))190    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))191    192    f.write("Sexaul Harassment" + ", " + 193    str(date) + " " + str(time) + ", " + 194    str(random.uniform(37.5527263, 37.5544725)) + ", " + 195    str(random.uniform(126.9735413, 126.9860058)) + "\n")196############################# 8 #############################197# create Theft data (15)198for i in range(0, 15):199    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))200    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))201    f.write("Theft" + ", " + 202    str(date) + " " + str(time) + ", " + 203    str(random.uniform(37.5689393, 37.5697908)) + ", " + 204    str(random.uniform(126.9723007, 126.9836303)) + "\n")205# create Assault data (13)206for i in range(0, 13):207    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))208    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))209    210    f.write("Assault" + ", " + 211    str(date) + " " + str(time) + ", " + 212    str(random.uniform(37.5689393, 37.5697908)) + ", " + 213    str(random.uniform(126.9723007, 126.9836303)) + "\n")214# create Sexual Harassment data (2)215for i in range(0, 2):216    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))217    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))218    219    f.write("Sexaul Harassment" + ", " + 220    str(date) + " " + str(time) + ", " + 221    str(random.uniform(37.5689393, 37.5697908)) + ", " + 222    str(random.uniform(126.9723007, 126.9836303)) + "\n")223############################# 9 #############################224# create Theft data (25)225for i in range(0, 25):226    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))227    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))228    f.write("Theft" + ", " + 229    str(date) + " " + str(time) + ", " + 230    str(random.uniform(37.5690853, 37.5699044)) + ", " + 231    str(random.uniform(126.9983472, 127.0176016)) + "\n")232# create Assault data (22)233for i in range(0, 22):234    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))235    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))236    237    f.write("Assault" + ", " + 238    str(date) + " " + str(time) + ", " + 239    str(random.uniform(37.5690853, 37.5699044)) + ", " + 240    str(random.uniform(126.9983472, 127.0176016)) + "\n")241# create Sexual Harassment data (4)242for i in range(0, 4):243    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))244    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))245    246    f.write("Sexaul Harassment" + ", " + 247    str(date) + " " + str(time) + ", " + 248    str(random.uniform(37.5690853, 37.5699044)) + ", " + 249    str(random.uniform(126.9983472, 127.0176016)) + "\n")250############################# 10 #############################251# create Theft data (21)252for i in range(0, 21):253    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))254    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))255    f.write("Theft" + ", " + 256    str(date) + " " + str(time) + ", " + 257    str(random.uniform(37.5600986, 37.5727126)) + ", " + 258    str(random.uniform(127.0232410, 127.0244540)) + "\n")259# create Assault data (19)260for i in range(0, 19):261    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))262    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))263    264    f.write("Assault" + ", " + 265    str(date) + " " + str(time) + ", " + 266    str(random.uniform(37.5600986, 37.5727126)) + ", " + 267    str(random.uniform(127.0232410, 127.0244540)) + "\n")268# create Sexual Harassment data (2)269for i in range(0, 2):270    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))271    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))272    273    f.write("Sexaul Harassment" + ", " + 274    str(date) + " " + str(time) + ", " + 275    str(random.uniform(37.5600986, 37.5727126)) + ", " + 276    str(random.uniform(127.0232410, 127.0244540)) + "\n")277############################# 11 #############################278# create Theft data (12)279for i in range(0, 12):280    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))281    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))282    f.write("Theft" + ", " + 283    str(date) + " " + str(time) + ", " + 284    str(random.uniform(37.5619098, 37.5655062)) + ", " + 285    str(random.uniform(127.0244196, 127.0267064)) + "\n")286# create Assault data (11)287for i in range(0, 11):288    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))289    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))290    291    f.write("Assault" + ", " + 292    str(date) + " " + str(time) + ", " + 293    str(random.uniform(37.5619098, 37.5655062)) + ", " + 294    str(random.uniform(127.0244196, 127.0267064)) + "\n")295# create Sexual Harassment data (1)296for i in range(0, 1):297    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))298    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))299    300    f.write("Sexaul Harassment" + ", " + 301    str(date) + " " + str(time) + ", " + 302    str(random.uniform(37.5619098, 37.5655062)) + ", " + 303    str(random.uniform(127.0244196, 127.0267064)) + "\n")304############################# 12 #############################305# create Theft data (6)306for i in range(0, 6):307    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))308    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))309    f.write("Theft" + ", " + 310    str(date) + " " + str(time) + ", " + 311    str(random.uniform(37.5709116, 37.5717914)) + ", " + 312    str(random.uniform(127.0187169, 127.0232510)) + "\n")313# create Assault data (5)314for i in range(0, 5):315    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))316    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))317    318    f.write("Assault" + ", " + 319    str(date) + " " + str(time) + ", " + 320    str(random.uniform(37.5709116, 37.5717914)) + ", " + 321    str(random.uniform(127.0187169, 127.0232510)) + "\n")322# create Sexual Harassment data (0)323#for i in range(0, 0):324#    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))325#    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))326#    327#    f.write("Sexaul Harassment" + ", " + 328#    str(date) + " " + str(time) + ", " + 329#    str(random.uniform(37.5709116, 37.5717914)) + ", " + 330#    str(random.uniform(127.0187169, 127.0232510)) + "\n")331############################# 13 #############################332# create Theft data (6)333for i in range(0, 6):334    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))335    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))336    f.write("Theft" + ", " + 337    str(date) + " " + str(time) + ", " + 338    str(random.uniform(37.5474326, 37.5492220)) + ", " + 339    str(random.uniform(127.0098079, 127.0120788)) + "\n")340# create Assault data (5)341for i in range(0, 5):342    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))343    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))344    345    f.write("Assault" + ", " + 346    str(date) + " " + str(time) + ", " + 347    str(random.uniform(37.5474326, 37.5492220)) + ", " + 348    str(random.uniform(127.0098079, 127.0120788)) + "\n")349# create Sexual Harassment data (1)350for i in range(0, 1):351    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))352    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))353    354    f.write("Sexaul Harassment" + ", " + 355    str(date) + " " + str(time) + ", " + 356    str(random.uniform(37.5474326, 37.5492220)) + ", " + 357    str(random.uniform(127.0098079, 127.0120788)) + "\n")358############################# 14 #############################359# create Theft data (9)360for i in range(0, 9):361    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))362    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))363    f.write("Theft" + ", " + 364    str(date) + " " + str(time) + ", " + 365    str(random.uniform(37.5473675, 37.5491551)) + ", " + 366    str(random.uniform(126.9939592, 126.9973658)) + "\n")367# create Assault data (7)368for i in range(0, 7):369    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))370    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))371    372    f.write("Assault" + ", " + 373    str(date) + " " + str(time) + ", " + 374    str(random.uniform(37.5473675, 37.5491551)) + ", " + 375    str(random.uniform(126.9939592, 126.9973658)) + "\n")376# create Sexual Harassment data (2)377for i in range(0, 2):378    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))379    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))380    381    f.write("Sexaul Harassment" + ", " + 382    str(date) + " " + str(time) + ", " + 383    str(random.uniform(37.5473675, 37.5491551)) + ", " + 384    str(random.uniform(126.9939592, 126.9973658)) + "\n")385############################# 15 #############################386# create Theft data (12)387for i in range(0, 12):388    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))389    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))390    f.write("Theft" + ", " + 391    str(date) + " " + str(time) + ", " + 392    str(random.uniform(37.5519494, 37.5546495)) + ", " + 393    str(random.uniform(127.0142998, 127.0177351)) + "\n")394# create Assault data (10)395for i in range(0, 10):396    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))397    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))398    399    f.write("Assault" + ", " + 400    str(date) + " " + str(time) + ", " + 401    str(random.uniform(37.5519494, 37.5546495)) + ", " + 402    str(random.uniform(127.0142998, 127.0177351)) + "\n")403# create Sexual Harassment data (2)404for i in range(0, 2):405    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))406    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))407    408    f.write("Sexaul Harassment" + ", " + 409    str(date) + " " + str(time) + ", " + 410    str(random.uniform(37.5519494, 37.5546495)) + ", " + 411    str(random.uniform(127.0142998, 127.0177351)) + "\n")412############################# 16 #############################413# create Theft data (6)414for i in range(0, 6):415    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))416    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))417    f.write("Theft" + ", " + 418    str(date) + " " + str(time) + ", " + 419    str(random.uniform(37.5598616, 37.5616501)) + ", " + 420    str(random.uniform(126.9655664, 126.9678445)) + "\n")421# create Assault data (5)422for i in range(0, 5):423    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))424    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))425    426    f.write("Assault" + ", " + 427    str(date) + " " + str(time) + ", " + 428    str(random.uniform(37.5598616, 37.5616501)) + ", " + 429    str(random.uniform(126.9655664, 126.9678445)) + "\n")430# create Sexual Harassment data (1)431for i in range(0, 1):432    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))433    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))434    435    f.write("Sexaul Harassment" + ", " + 436    str(date) + " " + str(time) + ", " + 437    str(random.uniform(37.5598616, 37.5616501)) + ", " + 438    str(random.uniform(126.9655664, 126.9678445)) + "\n")439############################# 17 #############################440# create Theft data (12)441for i in range(0, 12):442    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))443    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))444    f.write("Theft" + ", " + 445    str(date) + " " + str(time) + ", " + 446    str(random.uniform(37.5526404, 37.5544163)) + ", " + 447    str(random.uniform(126.9610906, 126.9656221)) + "\n")448# create Assault data (10)449for i in range(0, 10):450    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))451    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))452    453    f.write("Assault" + ", " + 454    str(date) + " " + str(time) + ", " + 455    str(random.uniform(37.5526404, 37.5544163)) + ", " + 456    str(random.uniform(126.9610906, 126.9656221)) + "\n")457# create Sexual Harassment data (2)458for i in range(0, 2):459    date = "2019-" + str(random.randrange(1, 13)) + "-" + str(random.randrange(1, 31))460    time = str(random.randrange(0, 24)) + ":" + str(random.randrange(0, 60)) + ":" + str(random.randrange(0, 60))461    462    f.write("Sexaul Harassment" + ", " + 463    str(date) + " " + str(time) + ", " + 464    str(random.uniform(37.5526404, 37.5544163)) + ", " + 465    str(random.uniform(126.9610906, 126.9656221)) + "\n")466# Robber467# Murder468# close file...emitentes_entrega.factory.js
Source:emitentes_entrega.factory.js  
1var faker = require('faker');2module.exports = class EmitentesEntregaFactory {3    4    constructor(estados) {5              6        this.inscricaoEstadual = [7            'ISENTO',8            09        ];10        this.estados = estados;11        this.caixaPostal = [12            '',13            014        ];15        this.linhasProduto = [16            'MC',17            'Roupa',18            'GRÃOS',19            'SOFTWARE',20            'INDUSTRI',21            'TELEFONE',22            'HOSPEDAG',23            'DIVERSOS',24            'TEL/XERO',25            'TRATAMEN',26            'FERRAMEN',27            'EMBALAGE',28            'FORC/LUZ'29        ];30        this.ramosAtividade = [31            'TESTE',32            'RURAL',33            'COMERCIO',34            'INDUSTRIA',35            'CONSUMID',36            'Textil',37            'CAPIROTO',38            'FAB.PROD',39            'Clientes Ext',40            'AGRÃCOLA',41            'Industria',42            '1',43            '009999',44            '11',45            'comercio',46            'CONSUMIDOR',47            'Oi',48            'Rural',49            'rural',50            '12345678',51            'sul',52            'sullll',53            'TRANSPOR'54        ];55        this.dataInicio = new Date(2018, 0, 1);56        this.dataFim = new Date(2018, 12, 31);  57        58        this.bancos = [59            '654',60            '246',61            '025',62            '641',63            '213',64            '019',65            '029',66            '000',67            '740',68            '107',69            '031',70            '739',71            '096',72            '318',73            '752',74            '248',75            '218',76            '065',77            '036',78            '204',79            '394',80            '237',81            '225',82            'M15',83            '208',84            '044',85            '263',86            '473',87            '412',88            '040',89            '745',90            'M08',91            '241',92            'M19',93            '215',94            '756',95            '748',96            '075',97            '721',98            '222',99            '505',100            '229',101            '266',102            '003',103            '083-3',104            'M21',105            '707',106            '300',107            '495',108            '494',109            'M06',110            '024',111            '456',112            '214',113            '001',114            '047',115            '037',116            '039',117            '041',118            '004',119            '265',120            'M03',121            '224',122            '626',123            'M18',124            '233',125            '734',126            'M07',127            '612',128            'M22',129            '063',130            'M11',131            '604',132            '320',133            '653',134            '630',135            '077-9',136            '249',137            'M09',138            '184',139            '479',140            '376',141            '074',142            '217',143            '076',144            '757',145            '600',146            '212',147            'M12',148            '389',149            '746',150            'M10',151            '738',152            '066',153            '243',154            '045',155            'M17',156            '623',157            '611',158            '613',159            '094-2',160            '643',161            '724',162            '735',163            '638',164            'M24',165            '747',166            '088-4',167            '356',168            '633',169            '741',170            'M16',171            '072',172            '453',173            '422',174            '033',175            '250',176            '743',177            '749',178            '366',179            '637',180            '012',181            '464',182            '082-5',183            'M20',184            'M13',185            '634',186            'M14',187            'M23',188            '655',189            '610',190            '370',191            '021',192            '719',193            '755',194            '744',195            '073',196            '078',197            '069',198            '070',199            '092-2',200            '104',201            '477',202            '081-7',203            '097-3',204            '085-x',205            '099-x',206            '090-2',207            '089-2',208            '087-6',209            '098-1',210            '487',211            '751',212            '064',213            '062',214            '399',215            '168',216            '492',217            '652',218            '341',219            '079',220            '488',221            '014',222            '753',223            '086-8',224            '254',225            '409',226            '230',227            '091-4',228            '084'229        ];230        this.countries = [231            'Argentina',232            'Brasil',233            'Bolivia',234            'Alemanha',235            'Estados Unidos',236            'Bangladesh',237            'Congo'238        ];   239    }240    geraEmitentesEntrega(quantidadeRegistros) {       241        let numeroRegistros = quantidadeRegistros;242        let _emitentesEntrega = [];243        for (let i = 1; i <= numeroRegistros; i++) {244            245            let randomCard = faker.helpers.createCard();246            let phone = faker.random.arrayElement(247                [248                    '',249                    randomCard.phone,250                ]251            );252            this.inscricaoEstadual[1] = faker.random.number({min: 11111111111, max: 99999999999999});  253            this.caixaPostal[1] = faker.random.number({min: 11111111, max: 99999999});  254            _emitentesEntrega.push({255                "id": i,256                "nomeAbreviado": randomCard.name,257                "codigo": i,  258                "nome": faker.name.firstName() + " " + faker.name.lastName(),    259                "matriz": randomCard.company.name,260                "grupo": faker.random.number({min: 0, max: 99}),261                "CGC": faker.random.number({min: 0, max: 642840580001978999}), 262                "natureza": faker.random.number({min: 1, max: 3}),263                "inscricaoEstadual": faker.random.arrayElement(this.inscricaoEstadual),264                "endereco": randomCard.address.streetA,265                "endereco2": randomCard.address.streetB,266                "bairro": randomCard.address.streetC,267                "cidade": randomCard.address.city,268                "estado": faker.random.arrayElement(this.estados),269                "cep": faker.random.arrayElement(270                    [271                        faker.random.number({min: 11111111, max: 99999999 }),272                        randomCard.address.zipcode273                    ]274                ),275                "caixaPostal": faker.random.arrayElement(this.caixaPostal),276                "pais": faker.random.arrayElement(this.countries),277                "transportadorPadrao": faker.random.number({min: 0, max: 99999}),278                "linhaProduto": faker.random.arrayElement(this.linhasProduto),279                "ramoAtividade": faker.random.arrayElement(this.ramosAtividade),280                "dataImplantacao": faker.date.between(this.dataInicio, this.dataFim),281                "emissaoPedido": faker.random.number({min: 1, max: 2}),282                "prog": faker.random.boolean(),   // Não-Sim283                "mensagem": faker.random.number({min: 0, max: 1000}),284                "telefone": phone,285                "ramalTelefone": faker.random.arrayElement(['', faker.random.number({min: 0, max: 500})]),286                "telefaxRamal": faker.random.arrayElement(['', faker.random.number({min: 0, max: 500})]),287                "telefax": phone,288                "telex": phone,289                "telefax2": phone,290                "ramalTelefax2": faker.random.arrayElement(['', faker.random.number({min: 0, max: 500})]),291                "telefoneModem": phone,292                "ramalTelefone": faker.random.arrayElement(['', faker.random.number({min: 0, max: 500})]),293                "modem": phone,294                "email": randomCard.email,295                "homePage": randomCard.website,296                "parceiroEDI": faker.random.number({min: 0, max: 555}),297                "portador": faker.random.number({min: 0, max: 99999}),298                "modalidadeAP": faker.random.number({min: 1, max: 7}),299                "banco": faker.random.arrayElement(this.bancos),300                "agencia": faker.random.arrayElement(['', faker.random.number({min: 0, max: 999999})]),301                "contaCorrente": faker.random.arrayElement(['', faker.random.number({min: 0, max: 999999})]),302                "taxaFinanceira": faker.random.number({min: 0, max: 50}),303                "diasTaxaFinanceira": faker.random.number({min: 0, max: 200}),304                "tipoPagamento": faker.random.number({min: 0, max: 8}),305                "diasCompensacao": faker.random.number({min: 0, max: 200}),306                "tipoDespesaPadrao": faker.random.number({min: 0, max: 200}),307                "condicaoPagamento": faker.random.number({min: 0, max: 1000}),308                "vencimentoFeriado": faker.random.number({min: 1, max: 3}),309                "vencimentoDomingo": faker.random.number({min: 1, max: 3}),310                "vencimentoSabado": faker.random.number({min: 1, max: 3}),311                "observacao": faker.lorem.paragraphs(),312                "agenteRetencao": faker.random.boolean(),313                "rendimento": faker.random.boolean(),314                "tributacaoCOFINS": faker.random.number({min: 0, max: 2}),315                "tributacaoPIS": faker.random.number({min: 0, max: 2}),316                "PIS_COFINSporUnidade": faker.random.boolean(),317                "contribuinteSubstitutoIntermediario": faker.random.boolean(),318                "optanteCreditoPresumidoSubstituicaoTributaria": faker.random.boolean(),319                "InscrAuxST": faker.random.arrayElement(['', faker.lorem.word()]),320                "pagamentos": faker.random.number({min: 1, max: 2})321            });322        }323        return _emitentesEntrega;324    }325    ...bubble.js
Source:bubble.js  
...12$(window).on("load", function(){13    //Get the context of the Chart canvas element we want to select14    var ctx = $("#bubble-chart");15    var randomScalingFactor = function() {16       return (Math.random() > 0.5 ? 1.0 : -1.0) * Math.round(Math.random() * 100);17    };18    // Chart Options19    var chartOptions = {20        responsive: true,21        maintainAspectRatio: false,22        scales: {23            xAxes: [{24                display: true,25                gridLines: {26                    color: "#f3f3f3",27                    drawTicks: false,28                },29                scaleLabel: {30                    display: true,31                    labelString: 'Month'32                }33            }],34            yAxes: [{35                display: true,36                gridLines: {37                    color: "#f3f3f3",38                    drawTicks: false,39                },40                scaleLabel: {41                    display: true,42                    labelString: 'Value'43                }44            }]45        },46        title:{47            display:false,48            text:'Chart.js Bubble Chart'49        }50    };51    // Chart Data52    var chartData = {53        animation: {54            duration: 1000055        },56        datasets: [{57            label: "Medicine 1",58            backgroundColor: "#64FFDA",59            borderColor: "#64FFDA",60            data: [61                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},62                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},63                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},64                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},65                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},66                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},67                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},68            ]69        }, {70            label: "Medicine 2",71            backgroundColor: "#FF4081",72            borderColor: "#FF4081",73            data: [74                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},75                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},76                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},77                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},78                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},79                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},80                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},81            ]82        },{83            label: "Medicine 3",84            backgroundColor: "#7C4DFF",85            borderColor: "#7C4DFF",86            data: [87                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},88                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},89                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},90                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},91                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},92                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},93                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},94            ]95        }, {96            label: "Medicine 4",97            backgroundColor: "#FF6E40",98            borderColor: "#FF6E40",99            data: [100                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},101                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},102                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},103                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},104                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},105                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},106                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},107            ]108        },{109            label: "Medicine 5",110            backgroundColor: "#FFFF00",111            borderColor: "#FFFF00",112            data: [113                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},114                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},115                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},116                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},117                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},118                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},119                { x: randomScalingFactor(), y: randomScalingFactor(), r: Math.abs(randomScalingFactor()) / 5},120            ]121        }]122    };123    var config = {124        type: 'bubble',125        // Chart Options126        options : chartOptions,127        data : chartData128    };129    // Create the chart130    var bubbleChart = new Chart(ctx, config);131    // Randomize bubble chart data132    window.setInterval(function(){133        var zero = Math.random() < 0.2 ? true : false;134        colors = ["#64FFDA","#FF4081","#7C4DFF","#FF6E40","#FFEA00"];135        $.each(chartData.datasets, function(i, dataset) {136            dataset.backgroundColor = colors[i];137            dataset.borderColor = colors[i];138            dataset.data = dataset.data.map(function() {139                return {140                    x: randomScalingFactor(),141                    y: randomScalingFactor(),142                    r: Math.abs(randomScalingFactor()) / 5,143                };144            });145        });146        bubbleChart.update();147    },2000);...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
