|
85 | 85 | }, |
86 | 86 | { |
87 | 87 | "cell_type": "code", |
88 | | - "execution_count": 2, |
| 88 | + "execution_count": 13, |
89 | 89 | "metadata": { |
90 | 90 | "editable": true, |
91 | 91 | "slideshow": { |
|
103 | 103 | "Illegal Parking 34297\n", |
104 | 104 | "Request Large Bulky Item Collection 30939\n", |
105 | 105 | "Blocked Driveway 25530\n", |
106 | | - " ... \n", |
107 | | - "eval(compile('for x in rang... 1\n", |
108 | | - "Misc. Comments\"|echo 2... 1\n", |
109 | | - "Bereavement Support Group 1\n", |
110 | | - "Misc. Comments'|echo y9v6fc... 1\n", |
111 | | - "Appliance 1\n", |
112 | | - "Name: count, Length: 248, dtype: int64" |
| 106 | + "Name: count, dtype: int64" |
113 | 107 | ] |
114 | 108 | }, |
115 | | - "execution_count": 2, |
| 109 | + "execution_count": 13, |
116 | 110 | "metadata": {}, |
117 | 111 | "output_type": "execute_result" |
118 | 112 | } |
119 | 113 | ], |
120 | 114 | "source": [ |
121 | | - "requests[\"Complaint Type\"].value_counts()" |
| 115 | + "requests[\"Complaint Type\"].value_counts().head()" |
122 | 116 | ] |
123 | 117 | }, |
124 | 118 | { |
|
136 | 130 | }, |
137 | 131 | { |
138 | 132 | "cell_type": "code", |
139 | | - "execution_count": 3, |
| 133 | + "execution_count": 14, |
140 | 134 | "metadata": { |
141 | 135 | "editable": true, |
142 | 136 | "id": "S90gXzXAiFoC", |
|
156 | 150 | "Illegal Parking 34297\n", |
157 | 151 | "Request Large Bulky Item Collection 30939\n", |
158 | 152 | "Blocked Driveway 25530\n", |
159 | | - " ... \n", |
160 | | - "Misc. Comments'|ping -c 21 ... 1\n", |
161 | | - "Overflowing Recycling Baskets 1\n", |
162 | | - "Public Assembly 1\n", |
163 | | - "Select Message Type... 1\n", |
164 | | - "{!xmlparser v='<!DOCTYPE... 1\n", |
165 | | - "Length: 248, dtype: int64" |
| 153 | + "dtype: int64" |
166 | 154 | ] |
167 | 155 | }, |
168 | | - "execution_count": 3, |
| 156 | + "execution_count": 14, |
169 | 157 | "metadata": {}, |
170 | 158 | "output_type": "execute_result" |
171 | 159 | } |
172 | 160 | ], |
173 | 161 | "source": [ |
174 | | - "requests.groupby(\"Complaint Type\").size().sort_values(ascending=False)" |
175 | | - ] |
176 | | - }, |
177 | | - { |
178 | | - "cell_type": "markdown", |
179 | | - "metadata": { |
180 | | - "editable": true, |
181 | | - "slideshow": { |
182 | | - "slide_type": "" |
183 | | - }, |
184 | | - "tags": [] |
185 | | - }, |
186 | | - "source": [ |
187 | | - "`.reset_index(name='count')` isn't necessary, but it's helpful to include because it allows us to name the new column that contains the count of rows." |
| 162 | + "requests.groupby(\"Complaint Type\").size().nlargest()" |
188 | 163 | ] |
189 | 164 | }, |
190 | 165 | { |
|
0 commit comments