Skip to content

Commit b6ccf8d

Browse files
committed
try different method for makeing value_counts() output the same across machines
1 parent b401638 commit b6ccf8d

File tree

1 file changed

+8
-33
lines changed

1 file changed

+8
-33
lines changed

lecture_1_demo_solutions.ipynb

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
},
8686
{
8787
"cell_type": "code",
88-
"execution_count": 2,
88+
"execution_count": 13,
8989
"metadata": {
9090
"editable": true,
9191
"slideshow": {
@@ -103,22 +103,16 @@
103103
"Illegal Parking 34297\n",
104104
"Request Large Bulky Item Collection 30939\n",
105105
"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"
113107
]
114108
},
115-
"execution_count": 2,
109+
"execution_count": 13,
116110
"metadata": {},
117111
"output_type": "execute_result"
118112
}
119113
],
120114
"source": [
121-
"requests[\"Complaint Type\"].value_counts()"
115+
"requests[\"Complaint Type\"].value_counts().head()"
122116
]
123117
},
124118
{
@@ -136,7 +130,7 @@
136130
},
137131
{
138132
"cell_type": "code",
139-
"execution_count": 3,
133+
"execution_count": 14,
140134
"metadata": {
141135
"editable": true,
142136
"id": "S90gXzXAiFoC",
@@ -156,35 +150,16 @@
156150
"Illegal Parking 34297\n",
157151
"Request Large Bulky Item Collection 30939\n",
158152
"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"
166154
]
167155
},
168-
"execution_count": 3,
156+
"execution_count": 14,
169157
"metadata": {},
170158
"output_type": "execute_result"
171159
}
172160
],
173161
"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()"
188163
]
189164
},
190165
{

0 commit comments

Comments
 (0)