We can't make this file beautiful and searchable because it's too large.
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
| customer_id,customer_name,age,income,credit_score,debt_to_income_ratio,employment_status,loan_amount,loan_term,payment_history,number_of_dependents | |
| 014854802,Susan Johnson-Gray,46,69833,532,0.92,Employed,5221,12,Poor,2 | |
| 124248191,Terry Scott-Williams,24,92009,538,0.45,Self-employed,18921,24,Good,1 | |
| 030481000,Kayleigh Green,40,46528,351,0.82,Unemployed,25268,24,Good,2 | |
| 055589725,Patrick Nelson,49,95130,379,0.25,Unemployed,16140,24,Fair,3 | |
| 032302404,Roy Walton,27,63428,447,0.52,Employed,27707,12,Fair,4 | |
| 105153962,Ms. Lauren Smith,25,61517,305,0.72,Employed,8386,60,Good,4 | |
| 066974989,Charlotte Brown-Dennis,35,26148,810,0.5,Unemployed,39172,48,Good,0 | |
| 034953149,Hazel Cole-Price,50,68271,838,0.74,Self-employed,36045,36,Poor,1 | |
| 110903796,Hugh Harper,23,61384,513,0.58,Unemployed,26298,36,Poor,1 |
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
| property_name | number_of_bedrooms | monthly_rent | agency_name | |
|---|---|---|---|---|
| West Parkside, Greenwich, London, SE10 | 1 bedroom flat share | £1,050 pcm | by 1st Avenue New, London | |
| Rectory Square, London | 1 bedroom flat | £1,500 pcm | by CITY REALTOR, London | |
| The Sphere, 1 Hallsville Road, E16 1BE | 1 bedroom flat | £1,280 pcm | by London & Queue Housing Trust | |
| West Parkside, Greenwich, London, SE10 | 1 bedroom flat share | £1,050 pcm | by 1st Avenue New, London | |
| Longshore, London SE8 | 1 bedroom flat share | £850 pcm | by Maurice Mark Louis, London | |
| Bowline Court, Telegraph Avenue, SE10 | 1 bedroom apartment | £1,300 pcm | by London & Queue Housing Trust | |
| Byng Street, Canary Wharf, London E14 | Studio flat | £1,430 pcm | by Chase Evans Chris, Peninsula | |
| Caspian Wharf, London, E3 | Studio flat | £1,500 pcm | by OpenRentForYou, London | |
| Falcon Way, London, UK, E14 | 1 bedroom apartment | £1,500 pcm | by SALettings, Canary Wharf |
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
| #creating generator expression from another generator expression. | |
| generator_one=(x for x in range(1,11)) | |
| generator_two=(y**2 for y in generator_one if y%2==0) | |
| for i in generator_two: | |
| print(i) |
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
| sum_gen=sum(num_cube_generator) | |
| print(f"Sum = {sum_gen}") |
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
| #Generator Expression | |
| num_cube_lc=[n**3 for n in range(1,11) if n%2==0] | |
| num_cube_generator=(num**3 for num in range(1,11) if num%2==0) | |
| print(f"List Comprehension = {num_cube_lc}") | |
| print(f"Generator Expression = {num_cube_generator}") |
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
| #printing values using next() | |
| print(next(num_gen)) | |
| print(next(num_gen)) | |
| print(next(num_gen)) | |
| print(next(num_gen)) | |
| #looping over generator object | |
| for number in num_gen: | |
| print(f"Remaining elements in stream: {number}") |
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
| #Generator Function | |
| def even_num_gen(n1): | |
| '''This generator function yields the cube for numbers within a given range. ''' | |
| for i in range(n1): | |
| yield i**3 | |
| num_gen=even_num_gen(10) | |
| print(f"Generator object: {num_gen}") |
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
| #Regular Function | |
| def num_cube(n1): | |
| '''This fuction returns a list of cubes for numbers within a given range.''' | |
| cube=[] | |
| for numbers in range(n1): | |
| cube.append(numbers**3) | |
| return cube | |
| nums=num_cube(10) |
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
| #time comparision | |
| from timeit import timeit | |
| t1=timeit('list_num=[n1 for n1 in range(1000000000)]') | |
| print(t1) | |
| t2=timeit('gen_num=(n2 for n2 in range(1000000000))') | |
| print(t2) |
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
| #storage comparision | |
| from sys import getsizeof | |
| list_num=[n1 for n1 in range(1000000000)] #list-comprehension | |
| gen_num=(n2 for n2 in range(1000000000)) #generator-expression | |
| print(f"Size of a list: {getsizeof(list_num)} bytes") | |
| print(f"Size of a generator: {getsizeof(gen_num)} bytes") |
NewerOlder