Question
Python Pandas, Series and DataFrame Question (NO Loops, No If Statements, No List Comprehensions) The file bank.csv contains data about bank customers. The last column
Python Pandas, Series and DataFrame Question (NO Loops, No If Statements, No List Comprehensions)
The file bank.csv contains data about bank customers. The last column ('Personal Loan') indicates whether or not the customer was approved for a personal loan or not. Write a function named loan_by_zip that accepts 3 parameters: a file name, a minimum number of records, and a percentage approval rate. The function should return a DataFrame of those zip codes for which we meet the minimum number of records and the loan approval rate for that zip code (1 = approved, 0 = not approved).
Find below the file, bank.csv. Please note this is only a fraction of the file as it is too large to paste here.
ID | Age | Experience | Income | ZIP Code | Family | CCAvg | Education | Mortgage | Securities Account | CD Account | Online | CreditCard | Personal Loan |
2001 | 28 | 2 | 22 | 95670 | 1 | 0.1 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2002 | 44 | 17 | 128 | 94928 | 2 | 3.25 | 2 | 0 | 0 | 0 | 0 | 1 | 1 |
2003 | 30 | 4 | 142 | 92126 | 3 | 4.2 | 1 | 359 | 0 | 0 | 0 | 0 | 1 |
2004 | 44 | 20 | 124 | 90277 | 1 | 4.7 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2005 | 30 | 4 | 44 | 92704 | 1 | 1.9 | 3 | 143 | 0 | 0 | 0 | 0 | 0 |
2006 | 47 | 23 | 170 | 90254 | 2 | 6.5 | 2 | 0 | 0 | 1 | 1 | 1 | 1 |
2007 | 64 | 39 | 75 | 94720 | 4 | 0.1 | 2 | 0 | 0 | 1 | 1 | 1 | 0 |
2008 | 48 | 21 | 78 | 94010 | 3 | 2 | 2 | 0 | 0 | 0 | 1 | 1 | 0 |
2009 | 63 | 38 | 31 | 92037 | 1 | 1.1 | 3 | 125 | 0 | 0 | 1 | 0 | 0 |
2010 | 25 | 0 | 99 | 92735 | 1 | 1.9 | 1 | 323 | 0 | 0 | 0 | 0 | 0 |
2011 | 61 | 36 | 41 | 96001 | 2 | 1.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2012 | 46 | 21 | 39 | 92507 | 4 | 0 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2013 | 57 | 31 | 51 | 93943 | 1 | 1.4 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2014 | 40 | 15 | 52 | 92691 | 3 | 0.8 | 3 | 113 | 0 | 0 | 1 | 0 | 0 |
2015 | 49 | 19 | 169 | 95054 | 3 | 5.67 | 3 | 167 | 0 | 1 | 0 | 1 | 1 |
2016 | 30 | 5 | 141 | 95747 | 1 | 0.8 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2017 | 41 | 17 | 93 | 92835 | 4 | 0.8 | 1 | 218 | 0 | 0 | 0 | 0 | 0 |
2018 | 42 | 15 | 14 | 92064 | 3 | 1 | 2 | 0 | 1 | 0 | 0 | 0 | 0 |
2019 | 63 | 39 | 160 | 90089 | 2 | 2.1 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2020 | 43 | 17 | 44 | 94611 | 1 | 0.2 | 1 | 0 | 1 | 1 | 1 | 0 | 0 |
2021 | 59 | 34 | 33 | 94303 | 3 | 0.2 | 1 | 0 | 1 | 0 | 0 | 0 | 0 |
2022 | 46 | 20 | 103 | 91380 | 4 | 4.8 | 3 | 0 | 0 | 0 | 1 | 0 | 1 |
2023 | 33 | 3 | 71 | 93561 | 4 | 1.8 | 3 | 236 | 0 | 0 | 0 | 0 | 0 |
2024 | 55 | 29 | 55 | 94720 | 1 | 0.2 | 1 | 151 | 0 | 0 | 1 | 0 | 0 |
2025 | 36 | 12 | 113 | 94305 | 4 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
2026 | 47 | 20 | 79 | 94720 | 3 | 2 | 2 | 185 | 1 | 0 | 0 | 0 | 0 |
2027 | 59 | 33 | 80 | 93907 | 2 | 0.7 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2028 | 38 | 12 | 179 | 94596 | 2 | 0 | 1 | 380 | 0 | 0 | 0 | 0 | 0 |
2029 | 42 | 17 | 9 | 91710 | 2 | 0 | 3 | 0 | 0 | 0 | 0 | 0 | 0 |
2030 | 30 | 3 | 61 | 92152 | 4 | 2 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2031 | 63 | 38 | 111 | 95814 | 2 | 3.9 | 1 | 207 | 1 | 1 | 1 | 1 | 0 |
2032 | 60 | 35 | 80 | 94608 | 3 | 0.5 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2033 | 62 | 37 | 32 | 90266 | 3 | 0.2 | 1 | 0 | 1 | 0 | 0 | 1 | 0 |
2034 | 49 | 23 | 83 | 92126 | 1 | 0.3 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2035 | 59 | 33 | 91 | 92821 | 4 | 1.9 | 2 | 329 | 0 | 0 | 0 | 0 | 0 |
2036 | 36 | 10 | 29 | 93065 | 4 | 1 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2037 | 46 | 19 | 19 | 94305 | 3 | 0.67 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2038 | 35 | 8 | 52 | 95616 | 2 | 1 | 2 | 0 | 0 | 0 | 0 | 1 | 0 |
2039 | 50 | 24 | 150 | 94551 | 1 | 7.3 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2040 | 51 | 25 | 32 | 91605 | 2 | 0.4 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2041 | 41 | 16 | 91 | 94720 | 3 | 0.5 | 3 | 0 | 0 | 0 | 0 | 0 | 0 |
2042 | 45 | 20 | 180 | 95403 | 3 | 8.5 | 2 | 535 | 0 | 0 | 0 | 0 | 1 |
2043 | 41 | 17 | 121 | 94102 | 1 | 0.3 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2044 | 57 | 32 | 25 | 90049 | 2 | 0.2 | 3 | 0 | 0 | 0 | 1 | 1 | 0 |
2045 | 51 | 25 | 102 | 92677 | 1 | 0.3 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2046 | 52 | 28 | 44 | 95051 | 4 | 0.9 | 2 | 107 | 0 | 0 | 1 | 0 | 0 |
2047 | 43 | 16 | 161 | 95134 | 3 | 8 | 2 | 0 | 0 | 1 | 1 | 1 | 1 |
2048 | 63 | 38 | 134 | 90640 | 3 | 4 | 2 | 0 | 0 | 0 | 0 | 1 | 1 |
2049 | 28 | 4 | 43 | 94803 | 1 | 1.8 | 2 | 0 | 0 | 0 | 1 | 1 | 0 |
2050 | 43 | 18 | 94 | 92717 | 4 | 1.1 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2051 | 41 | 15 | 29 | 94024 | 2 | 0.8 | 3 | 98 | 0 | 0 | 0 | 0 | 0 |
2052 | 34 | 8 | 38 | 90018 | 4 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2053 | 28 | 3 | 120 | 94080 | 1 | 0.8 | 1 | 170 | 0 | 0 | 0 | 0 | 0 |
2054 | 58 | 32 | 85 | 92110 | 2 | 2 | 1 | 161 | 1 | 1 | 1 | 1 | 0 |
2055 | 39 | 15 | 89 | 92126 | 2 | 1.9 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2056 | 49 | 23 | 25 | 90274 | 1 | 1.4 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2057 | 33 | 8 | 20 | 92691 | 3 | 1.3 | 1 | 83 | 0 | 0 | 0 | 1 | 0 |
2058 | 37 | 12 | 125 | 91754 | 2 | 3.9 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2059 | 33 | 7 | 18 | 92093 | 1 | 0.6 | 3 | 0 | 0 | 0 | 0 | 0 | 0 |
2060 | 28 | 3 | 173 | 92121 | 2 | 6.7 | 1 | 222 | 0 | 0 | 1 | 0 | 0 |
2061 | 54 | 29 | 34 | 92093 | 4 | 0.1 | 3 | 0 | 0 | 0 | 1 | 1 | 0 |
2062 | 63 | 38 | 159 | 93950 | 4 | 4.9 | 2 | 111 | 0 | 0 | 0 | 0 | 1 |
2063 | 57 | 31 | 55 | 92521 | 3 | 2.5 | 1 | 219 | 0 | 1 | 1 | 1 | 0 |
2064 | 56 | 30 | 32 | 94080 | 2 | 0.4 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2065 | 54 | 29 | 65 | 94545 | 4 | 1.8 | 3 | 0 | 0 | 0 | 0 | 1 | 0 |
2066 | 29 | 5 | 83 | 92354 | 3 | 1.5 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2067 | 41 | 16 | 30 | 95814 | 2 | 1.4 | 2 | 0 | 0 | 0 | 0 | 1 | 0 |
2068 | 58 | 32 | 180 | 91770 | 1 | 2.9 | 1 | 0 | 0 | 0 | 0 | 1 | 0 |
2069 | 61 | 37 | 13 | 90024 | 2 | 0.3 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2070 | 30 | 4 | 35 | 90059 | 4 | 0.8 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2071 | 62 | 37 | 95 | 91107 | 3 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2072 | 52 | 28 | 83 | 94705 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2073 | 29 | 3 | 39 | 95831 | 4 | 0.2 | 1 | 137 | 0 | 0 | 1 | 1 | 0 |
2074 | 46 | 20 | 54 | 91107 | 1 | 0.7 | 3 | 154 | 0 | 0 | 1 | 1 | 0 |
2075 | 52 | 27 | 81 | 91942 | 1 | 1.3 | 3 | 293 | 0 | 0 | 0 | 1 | 0 |
2076 | 40 | 16 | 53 | 94123 | 4 | 2 | 3 | 0 | 0 | 0 | 0 | 0 | 0 |
2077 | 49 | 23 | 119 | 91030 | 1 | 7.3 | 1 | 398 | 0 | 0 | 0 | 0 | 0 |
2078 | 34 | 9 | 160 | 94108 | 4 | 8 | 3 | 0 | 0 | 0 | 0 | 1 | 1 |
2079 | 35 | 11 | 21 | 95814 | 2 | 1 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
2080 | 26 | 2 | 40 | 94132 | 1 | 1 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2081 | 65 | 40 | 69 | 91706 | 4 | 0.1 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2082 | 52 | 27 | 45 | 95006 | 1 | 1.3 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
2083 | 32 | 7 | 55 | 91301 | 4 | 2 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2084 | 31 | 7 | 38 | 94025 | 1 | 0.2 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2085 | 36 | 9 | 44 | 93907 | 4 | 1 | 2 | 101 | 1 | 0 | 1 | 0 | 0 |
2086 | 50 | 24 | 45 | 94105 | 3 | 0.6 | 2 | 117 | 0 | 0 | 1 | 0 | 0 |
2087 | 36 | 12 | 84 | 90291 | 1 | 0.8 | 2 | 0 | 0 | 0 | 1 | 1 | 0 |
2088 | 51 | 27 | 188 | 94305 | 2 | 6.9 | 2 | 343 | 0 | 0 | 1 | 0 | 1 |
2089 | 39 | 9 | 29 | 94701 | 3 | 2 | 3 | 151 | 1 | 0 | 0 | 0 | 0 |
2090 | 53 | 29 | 95 | 94304 | 1 | 2.7 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2091 | 50 | 25 | 79 | 95023 | 1 | 2.9 | 1 | 307 | 0 | 0 | 0 | 1 | 0 |
2092 | 31 | 4 | 41 | 91360 | 1 | 2 | 2 | 0 | 1 | 0 | 1 | 0 | 0 |
2093 | 53 | 23 | 19 | 92673 | 4 | 0.4 | 3 | 84 | 0 | 0 | 1 | 0 | 0 |
2094 | 48 | 23 | 75 | 94111 | 4 | 3.6 | 3 | 0 | 0 | 0 | 1 | 1 | 0 |
2095 | 57 | 31 | 64 | 90024 | 3 | 2.5 | 1 | 208 | 0 | 0 | 0 | 1 | 0 |
2096 | 47 | 21 | 174 | 94025 | 4 | 3.2 | 3 | 0 | 0 | 0 | 0 | 0 | 1 |
2097 | 55 | 29 | 54 | 95051 | 2 | 2.3 | 3 | 93 | 0 | 0 | 0 | 0 | 0 |
2098 | 37 | 11 | 14 | 90740 | 3 | 0.1 | 2 | 113 | 0 | 0 | 1 | 0 | 0 |
2099 | 59 | 35 | 94 | 90089 | 1 | 3.8 | 1 | 272 | 0 | 0 | 0 | 0 | 0 |
2100 | 53 | 29 | 10 | 90095 | 2 | 0.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2101 | 31 | 6 | 145 | 93940 | 1 | 0.8 | 1 | 84 | 0 | 0 | 1 | 0 | 0 |
2102 | 35 | 5 | 203 | 95032 | 1 | 10 | 3 | 0 | 0 | 0 | 0 | 0 | 1 |
2103 | 25 | -1 | 81 | 92647 | 2 | 1.6 | 3 | 0 | 0 | 0 | 1 | 1 | 0 |
2104 | 37 | 13 | 153 | 90630 | 2 | 6.5 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2105 | 40 | 14 | 58 | 90245 | 4 | 0.2 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2106 | 31 | 5 | 49 | 94114 | 4 | 1.8 | 3 | 0 | 0 | 0 | 1 | 1 | 0 |
2107 | 62 | 38 | 132 | 90210 | 1 | 2.9 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2108 | 41 | 17 | 85 | 90291 | 4 | 0.2 | 3 | 229 | 0 | 0 | 0 | 0 | 0 |
2109 | 56 | 32 | 85 | 94132 | 3 | 2.67 | 1 | 0 | 1 | 0 | 1 | 0 | 0 |
2110 | 47 | 23 | 178 | 93014 | 1 | 6.5 | 3 | 0 | 0 | 0 | 0 | 0 | 1 |
2111 | 28 | 4 | 104 | 94301 | 3 | 2.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2112 | 60 | 34 | 40 | 94105 | 1 | 1.6 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2113 | 27 | 2 | 103 | 93117 | 1 | 1.9 | 1 | 120 | 0 | 0 | 1 | 0 | 0 |
2114 | 57 | 33 | 25 | 92064 | 2 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2115 | 62 | 36 | 69 | 95039 | 2 | 1.7 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2116 | 57 | 31 | 30 | 95070 | 3 | 1.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2117 | 44 | 17 | 70 | 94920 | 3 | 2.67 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
2118 | 31 | 7 | 15 | 91380 | 3 | 0.9 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2119 | 31 | 5 | 125 | 91320 | 2 | 1.3 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2120 | 39 | 13 | 50 | 94923 | 3 | 0.5 | 3 | 0 | 0 | 0 | 0 | 0 | 0 |
2121 | 41 | 17 | 44 | 93106 | 1 | 0.3 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2122 | 41 | 17 | 38 | 92182 | 4 | 2.2 | 2 | 180 | 0 | 0 | 0 | 1 | 0 |
2123 | 55 | 29 | 64 | 93437 | 3 | 0.8 | 1 | 119 | 0 | 0 | 0 | 1 | 0 |
2124 | 28 | 2 | 9 | 95014 | 1 | 0.1 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2125 | 35 | 9 | 44 | 92054 | 3 | 0.9 | 1 | 89 | 0 | 0 | 0 | 0 | 0 |
2126 | 44 | 20 | 93 | 91910 | 4 | 0.8 | 1 | 101 | 0 | 0 | 1 | 0 | 0 |
2127 | 44 | 19 | 83 | 92121 | 4 | 0.4 | 1 | 141 | 0 | 0 | 0 | 0 | 0 |
2128 | 40 | 14 | 179 | 94720 | 2 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2129 | 65 | 40 | 40 | 94104 | 1 | 1.1 | 3 | 0 | 0 | 0 | 0 | 0 | 0 |
2130 | 35 | 10 | 58 | 91754 | 4 | 0.7 | 3 | 232 | 0 | 0 | 0 | 0 | 0 |
2131 | 55 | 31 | 74 | 94607 | 3 | 2.67 | 1 | 0 | 0 | 0 | 0 | 1 | 0 |
2132 | 55 | 31 | 15 | 95747 | 1 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2133 | 59 | 35 | 11 | 94949 | 2 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 |
2134 | 39 | 15 | 41 | 95035 | 1 | 2 | 2 | 176 | 0 | 0 | 1 | 0 | 0 |
2135 | 50 | 24 | 68 | 95821 | 1 | 1.5 | 2 | 120 | 0 | 0 | 1 | 1 | 0 |
2136 | 45 | 15 | 28 | 95039 | 1 | 0.75 | 3 | 0 | 1 | 0 | 0 | 0 | 0 |
2137 | 50 | 26 | 115 | 95008 | 1 | 1.2 | 3 | 0 | 0 | 0 | 0 | 1 | 1 |
2138 | 65 | 40 | 83 | 92354 | 4 | 0.1 | 2 | 247 | 0 | 0 | 1 | 0 | 0 |
2139 | 36 | 11 | 40 | 93611 | 2 | 1.1 | 2 | 166 | 1 | 0 | 0 | 0 | 0 |
2140 | 57 | 32 | 113 | 91768 | 1 | 0.1 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2141 | 53 | 27 | 89 | 92130 | 1 | 0.8 | 3 | 0 | 1 | 0 | 1 | 0 | 0 |
2142 | 28 | 4 | 38 | 92109 | 4 | 1.6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2143 | 55 | 31 | 62 | 93943 | 4 | 1.5 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2144 | 56 | 31 | 65 | 92093 | 3 | 1.7 | 1 | 109 | 0 | 0 | 0 | 0 | 0 |
2145 | 33 | 6 | 168 | 94720 | 3 | 5.67 | 2 | 0 | 1 | 1 | 1 | 0 | 1 |
2146 | 57 | 32 | 40 | 94720 | 3 | 1.7 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2147 | 27 | 3 | 30 | 93108 | 1 | 1 | 3 | 80 | 0 | 0 | 0 | 0 | 0 |
2148 | 27 | 3 | 20 | 92007 | 4 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2149 | 54 | 30 | 58 | 92007 | 2 | 3.2 | 3 | 0 | 0 | 0 | 0 | 0 | 0 |
2150 | 48 | 22 | 150 | 95039 | 1 | 7.3 | 1 | 193 | 0 | 0 | 0 | 0 | 0 |
2151 | 62 | 38 | 54 | 91320 | 1 | 0.8 | 1 | 0 | 1 | 0 | 0 | 1 | 0 |
2152 | 41 | 16 | 19 | 91730 | 2 | 0.3 | 2 | 105 | 0 | 0 | 0 | 0 | 0 |
2153 | 62 | 38 | 30 | 94304 | 3 | 0.1 | 3 | 128 | 0 | 0 | 1 | 0 | 0 |
2154 | 40 | 14 | 123 | 90041 | 1 | 5.2 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2155 | 32 | 8 | 45 | 94558 | 1 | 2.4 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
2156 | 62 | 38 | 154 | 94305 | 1 | 2.9 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2157 | 35 | 11 | 93 | 90747 | 2 | 2.7 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2158 | 25 | 0 | 71 | 93727 | 4 | 0.2 | 1 | 78 | 1 | 0 | 0 | 0 | 0 |
2159 | 50 | 25 | 83 | 94720 | 4 | 3.1 | 1 | 0 | 0 | 0 | 0 | 1 | 1 |
2160 | 61 | 35 | 99 | 94085 | 1 | 4.8 | 3 | 255 | 0 | 0 | 0 | 1 | 1 |
2161 | 43 | 17 | 55 | 93933 | 3 | 2.2 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
2162 | 52 | 28 | 38 | 94131 | 4 | 0.9 | 2 | 95 | 0 | 0 | 1 | 1 | 0 |
2163 | 39 | 13 | 74 | 95008 | 3 | 0.9 | 2 | 155 | 0 | 0 | 1 | 0 | 0 |
2164 | 33 | 3 | 69 | 92161 | 4 | 1.8 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2165 | 27 | 3 | 104 | 92007 | 2 | 2.5 | 1 | 184 | 1 | 0 | 1 | 0 | 0 |
2166 | 27 | 0 | 38 | 95929 | 4 | 1 | 3 | 154 | 0 | 0 | 1 | 0 | 0 |
2167 | 32 | 8 | 25 | 93524 | 3 | 0.9 | 3 | 0 | 0 | 0 | 1 | 1 | 0 |
2168 | 65 | 40 | 162 | 94596 | 1 | 1.3 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2169 | 55 | 29 | 64 | 93063 | 4 | 2.6 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2170 | 52 | 27 | 30 | 94305 | 2 | 0.7 | 2 | 0 | 0 | 0 | 1 | 1 | 0 |
2171 | 39 | 13 | 52 | 95039 | 3 | 0.5 | 3 | 0 | 1 | 0 | 0 | 1 | 0 |
2172 | 35 | 11 | 42 | 93108 | 1 | 1.5 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2173 | 39 | 15 | 79 | 92028 | 2 | 1.8 | 2 | 219 | 0 | 0 | 0 | 0 | 0 |
2174 | 34 | 10 | 34 | 93407 | 1 | 1.7 | 1 | 164 | 0 | 0 | 0 | 0 | 0 |
2175 | 30 | 5 | 123 | 95605 | 2 | 3.1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2176 | 37 | 12 | 160 | 94305 | 2 | 3.3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2177 | 41 | 14 | 51 | 91320 | 3 | 2.33 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2178 | 31 | 7 | 108 | 94507 | 1 | 4 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2179 | 37 | 13 | 158 | 93943 | 2 | 2.3 | 2 | 0 | 0 | 1 | 1 | 1 | 1 |
2180 | 49 | 23 | 68 | 90024 | 1 | 1.5 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
2181 | 58 | 33 | 42 | 91380 | 2 | 1.6 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2182 | 45 | 15 | 32 | 94143 | 1 | 0.75 | 3 | 105 | 0 | 0 | 1 | 0 | 0 |
2183 | 40 | 14 | 22 | 94566 | 2 | 1.4 | 3 | 0 | 0 | 0 | 0 | 0 | 0 |
2184 | 34 | 8 | 29 | 90025 | 2 | 2 | 3 | 0 | 0 | 0 | 1 | 1 | 0 |
2185 | 62 | 36 | 183 | 90095 | 2 | 3.4 | 3 | 0 | 0 | 0 | 0 | 0 | 1 |
2186 | 54 | 30 | 69 | 92009 | 1 | 1.6 | 3 | 0 | 0 | 0 | 1 | 1 | 0 |
2187 | 26 | 2 | 92 | 96001 | 2 | 0.2 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2188 | 54 | 30 | 40 | 90024 | 2 | 1 | 3 | 0 | 0 | 0 | 0 | 0 | 0 |
2189 | 29 | 4 | 9 | 92037 | 4 | 0.5 | 3 | 86 | 0 | 0 | 1 | 1 | 0 |
2190 | 48 | 23 | 128 | 94309 | 1 | 0.6 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2191 | 27 | 3 | 110 | 96150 | 2 | 0.2 | 1 | 294 | 1 | 0 | 0 | 1 | 0 |
2192 | 42 | 18 | 171 | 90027 | 2 | 8 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2193 | 25 | 1 | 13 | 95814 | 4 | 1 | 1 | 95 | 0 | 0 | 0 | 1 | 0 |
2194 | 45 | 19 | 25 | 94609 | 2 | 0.1 | 3 | 102 | 0 | 0 | 1 | 0 | 0 |
2195 | 34 | 9 | 123 | 94553 | 1 | 1.6 | 2 | 0 | 0 | 0 | 1 | 0 | 1 |
2196 | 51 | 27 | 33 | 92037 | 4 | 0.2 | 1 | 83 | 0 | 0 | 1 | 0 | 0 |
2197 | 51 | 24 | 189 | 95211 | 4 | 4.75 | 2 | 0 | 0 | 0 | 1 | 0 | 1 |
2198 | 60 | 35 | 34 | 94102 | 1 | 0.3 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2199 | 59 | 35 | 58 | 91355 | 1 | 0 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2200 | 49 | 24 | 51 | 91016 | 1 | 1.3 | 2 | 98 | 0 | 0 | 0 | 1 | 0 |
2201 | 50 | 25 | 29 | 90095 | 2 | 1.3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2202 | 41 | 16 | 111 | 92009 | 2 | 0.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2203 | 49 | 24 | 43 | 94709 | 4 | 1.9 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2204 | 50 | 25 | 130 | 91320 | 1 | 0.6 | 1 | 311 | 0 | 0 | 0 | 0 | 0 |
2205 | 63 | 37 | 20 | 94704 | 2 | 0.4 | 1 | 76 | 0 | 0 | 0 | 0 | 0 |
2206 | 63 | 37 | 101 | 95819 | 2 | 2.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2207 | 33 | 7 | 48 | 92831 | 4 | 2.2 | 2 | 207 | 0 | 0 | 0 | 0 | 0 |
2208 | 38 | 12 | 180 | 90245 | 1 | 2.8 | 3 | 158 | 0 | 0 | 1 | 0 | 1 |
2209 | 64 | 40 | 92 | 91109 | 2 | 0 | 3 | 185 | 1 | 0 | 1 | 0 | 0 |
2210 | 36 | 10 | 33 | 94080 | 3 | 0.9 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2211 | 58 | 33 | 51 | 95006 | 2 | 1.9 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
2212 | 39 | 14 | 31 | 92717 | 2 | 1.4 | 2 | 94 | 0 | 0 | 1 | 1 | 0 |
2213 | 46 | 22 | 83 | 95060 | 1 | 2.7 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2214 | 61 | 37 | 45 | 94610 | 1 | 0.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2215 | 53 | 27 | 89 | 92735 | 1 | 0.8 | 3 | 146 | 0 | 0 | 1 | 1 | 0 |
2216 | 28 | 3 | 193 | 94501 | 3 | 4 | 2 | 0 | 0 | 0 | 1 | 0 | 1 |
2217 | 64 | 40 | 89 | 94707 | 1 | 3.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2218 | 48 | 24 | 162 | 91355 | 4 | 3.3 | 2 | 446 | 0 | 1 | 1 | 0 | 1 |
2219 | 38 | 13 | 9 | 92634 | 2 | 0.3 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
2220 | 52 | 22 | 58 | 93101 | 4 | 2 | 3 | 223 | 0 | 0 | 1 | 0 | 0 |
2221 | 65 | 40 | 80 | 94105 | 1 | 0.8 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2222 | 59 | 33 | 73 | 92056 | 2 | 1.7 | 3 | 0 | 0 | 0 | 1 | 1 | 0 |
2223 | 45 | 20 | 41 | 95008 | 1 | 0.3 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2224 | 53 | 28 | 74 | 91711 | 3 | 2 | 2 | 0 | 1 | 0 | 0 | 0 | 0 |
2225 | 38 | 12 | 29 | 92084 | 2 | 1.4 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2226 | 54 | 24 | 25 | 90505 | 4 | 0.4 | 3 | 115 | 0 | 0 | 0 | 0 | 0 |
2227 | 25 | 1 | 98 | 90717 | 1 | 5.4 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2228 | 61 | 35 | 59 | 90840 | 4 | 1.7 | 2 | 0 | 0 | 0 | 1 | 1 | 0 |
2229 | 48 | 23 | 43 | 90254 | 4 | 1.9 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2230 | 46 | 22 | 72 | 91711 | 4 | 1.4 | 2 | 149 | 0 | 0 | 1 | 1 | 0 |
2231 | 36 | 11 | 183 | 94704 | 1 | 3 | 3 | 0 | 0 | 1 | 1 | 1 | 1 |
2232 | 46 | 20 | 134 | 94575 | 1 | 5.7 | 1 | 146 | 1 | 0 | 1 | 0 | 0 |
2233 | 59 | 33 | 140 | 95035 | 2 | 0.5 | 1 | 262 | 0 | 0 | 1 | 0 | 0 |
2234 | 59 | 35 | 39 | 92028 | 1 | 1.8 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2235 | 36 | 12 | 35 | 95812 | 4 | 0.4 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2236 | 63 | 37 | 141 | 92121 | 2 | 6.9 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2237 | 51 | 24 | 23 | 95616 | 1 | 0.5 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2238 | 30 | 5 | 134 | 92647 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2239 | 48 | 22 | 35 | 92709 | 1 | 1.4 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2240 | 55 | 29 | 42 | 95833 | 4 | 2.5 | 1 | 0 | 1 | 0 | 0 | 0 | 0 |
2241 | 41 | 17 | 81 | 92868 | 4 | 0.2 | 3 | 167 | 1 | 0 | 0 | 0 | 0 |
2242 | 26 | 0 | 14 | 94301 | 4 | 0.4 | 1 | 94 | 0 | 0 | 1 | 0 | 0 |
2243 | 41 | 17 | 45 | 93437 | 1 | 1.8 | 1 | 172 | 1 | 0 | 1 | 0 | 0 |
2244 | 54 | 28 | 79 | 91342 | 3 | 1.7 | 2 | 150 | 0 | 0 | 1 | 1 | 0 |
2245 | 57 | 31 | 53 | 92806 | 1 | 0.8 | 2 | 120 | 0 | 0 | 0 | 0 | 0 |
2246 | 54 | 28 | 33 | 94111 | 2 | 0.7 | 2 | 0 | 0 | 0 | 0 | 1 | 0 |
2247 | 35 | 11 | 190 | 92093 | 3 | 3.1 | 2 | 266 | 0 | 0 | 0 | 0 | 1 |
2248 | 60 | 34 | 60 | 95616 | 1 | 2.5 | 3 | 103 | 0 | 0 | 0 | 0 | 0 |
2249 | 63 | 37 | 8 | 94618 | 1 | 0.8 | 2 | 97 | 0 | 0 | 1 | 0 | 0 |
2250 | 41 | 14 | 38 | 95814 | 3 | 1 | 2 | 150 | 0 | 0 | 1 | 0 | 0 |
2251 | 46 | 22 | 154 | 93109 | 1 | 5 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2252 | 31 | 5 | 54 | 92173 | 4 | 2.2 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
2253 | 58 | 32 | 41 | 95819 | 3 | 1.4 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2254 | 59 | 35 | 25 | 95827 | 2 | 0.3 | 1 | 75 | 0 | 0 | 1 | 0 | 0 |
2255 | 46 | 22 | 53 | 90025 | 2 | 1.7 | 1 | 109 | 0 | 0 | 0 | 0 | 0 |
2256 | 33 | 9 | 79 | 94612 | 1 | 0.1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2257 | 56 | 31 | 13 | 94305 | 4 | 0.9 | 2 | 76 | 0 | 1 | 1 | 1 | 0 |
2258 | 47 | 23 | 130 | 91763 | 2 | 1.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2259 | 59 | 33 | 93 | 91320 | 2 | 0.7 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
2260 | 24 | 0 | 82 | 90401 | 3 | 0.8 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2261 | 39 | 14 | 15 | 93561 | 2 | 0.3 | 2 | 92 | 0 | 0 | 0 | 0 | 0 |
2262 | 30 | 3 | 150 | 94305 | 4 | 5 | 2 | 0 | 0 | 0 | 1 | 0 | 1 |
2263 | 55 | 29 | 131 | 95070 | 2 | 0.7 | 2 | 0 | 0 | 0 | 0 | 1 | 1 |
2264 | 47 | 21 | 28 | 92868 | 3 | 1.5 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2265 | 35 | 11 | 9 | 93106 | 4 | 0.7 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2266 | 47 | 23 | 88 | 94305 | 4 | 1.4 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
2267 | 38 | 13 | 143 | 94550 | 1 | 4.1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2268 | 38 | 13 | 168 | 92647 | 2 | 1.3 | 3 | 0 | 0 | 0 | 0 | 0 | 1 |
2269 | 27 | 3 | 105 | 94304 | 1 | 3 | 2 | 0 | 1 | 0 | 0 | 0 | 1 |
2270 | 42 | 18 | 62 | 94305 | 3 | 2.1 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2271 | 26 | 2 | 51 | 92103 | 4 | 2.6 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2272 | 60 | 34 | 101 | 94928 | 3 | 4.4 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2273 | 27 | 3 | 90 | 91365 | 3 | 0.8 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2274 | 27 | 1 | 83 | 91775 | 4 | 2.1 | 3 | 0 | 0 | 0 | 1 | 1 | 0 |
2275 | 40 | 15 | 21 | 90034 | 2 | 0 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2276 | 40 | 16 | 115 | 94305 | 1 | 3.4 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2277 | 29 | 3 | 172 | 92093 | 4 | 4.4 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
2278 | 30 | 6 | 32 | 91330 | 2 | 1 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
2279 | 30 | 4 | 204 | 91107 | 2 | 4.5 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
2280 | 47 | 23 | 34 | 91711 | 4 | 0.6 | 1 | 0 | 0 | 1 | 1 | 1 | 0 |
2281 | 33 | 7 | 30 | 94920 | 2 | 2 | 3 | 132 | 0 | 0 | 0 | 0 | 0 |
2282 | 57 | 32 | 31 | 95039 | 3 | 1.3 | 2 | 0 | 0 | 0 | 1 | 1 | 0 |
2283 | 38 | 14 | 90 | 94110 | 2 | 2.7 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2284 | 54 | 28 | 79 | 92677 | 4 | 2.6 | 3 | 0 | 0 | 0 | 0 | 0 | 0 |
2285 | 47 | 23 | 22 | 94901 | 4 | 0.6 | 1 | 0 | 0 | 0 | 1 | 1 | 0 |
2286 | 48 | 22 | 114 | 92007 | 1 | 2.4 | 3 | 0 | 0 | 0 | 1 | 0 | 1 |
2287 | 62 | 36 | 42 | 94122 | 1 | 0.5 | 3 | 128 | 0 | 0 | 1 | 0 | 0 |
2288 | 30 | 6 | 29 | 92121 | 1 | 0.2 | 3 | 90 | 0 | 0 | 1 | 0 | 0 |
2289 | 35 | 11 | 72 | 94706 | 3 | 2.6 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2290 | 59 | 35 | 68 | 93117 | 1 | 1.8 | 3 | 95 | 0 | 0 | 0 | 0 | 0 |
2291 | 38 | 13 | 78 | 91942 | 4 | 0.7 | 3 | 0 | 0 | 0 | 1 | 0 | 0 |
2292 | 47 | 23 | 90 | 95449 | 1 | 2.7 | 1 | 323 | 0 | 0 | 0 | 0 | 0 |
2293 | 57 | 33 | 170 | 95051 | 2 | 2.1 | 2 | 0 | 0 | 0 | 0 | 0 | 1 |
2294 | 42 | 17 | 14 | 91768 | 2 | 0.1 | 2 | 0 | 0 | 0 | 1 | 0 | 0 |
2295 | 39 | 15 | 129 | 90035 | 2 | 1.9 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
2296 | 53 | 23 | 39 | 92101 | 3 | 1 | 3 | 87 | 0 | 0 | 1 | 0 | 0 |
2297 | 27 | 3 | 82 | 94305 | 2 | 0.2 | 1 | 0 | 0 | 0 | 0 | 1 | 0 |
2298 | 59 | 35 | 31 | 94063 | 3 | 0.4 | 2 | 0 | 0 | 0 | 1 | 1 | 0 |
2299 | 48 | 24 | 9 | 92630 | 4 | 0.5 | 2 | 0 | 0 | 0 | 0 | 1 | 0 |
2300 | 62 | 37 | 15 | 94583 | 3 | 0.1 | 3 | 91 | 0 | 0 | 0 | 0 | 0 |
In this example, we return all zip codes that have at least 2 records and a loan approval rate of 50% or greater:
In [1]: loan_by_zip('bank.csv',2,.5) Out[1]: ZIP Code mean size 90210 0.5 2 90254 0.5 2 91355 0.5 2 94131 0.5 2 94501 0.5 2 94704 0.5 2 94928 0.5 4 95054 1.0 2 95070 0.5 2 95211 0.5 2 95818 1.0 2
Point of Stress: This is strictly a Pandas, Series and DataFrame question (Pls no loops, no lf statements, no list comprehension). Please attach a print screen in addition to the code as evidence the scripts ran properly and as intended. Thanks.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started