Skip to content

Commit fdb0d06

Browse files
committed
1st ed done
1 parent 17f46d6 commit fdb0d06

12 files changed

Lines changed: 1094 additions & 102 deletions

categorical-data.ipynb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,18 +223,17 @@
223223
"source": [
224224
"### Renaming Categories\n",
225225
"\n",
226-
"Renaming categories is done by assigning new values to the `.cat.categories` property or by using the `rename_categories()` method (which works with a list or a dictionary)."
226+
"Renaming categories is done via the `rename_categories()` method (which works with a list or a dictionary)."
227227
]
228228
},
229229
{
230230
"cell_type": "code",
231231
"execution_count": null,
232-
"id": "aedcf10f",
232+
"id": "097171b8",
233233
"metadata": {},
234234
"outputs": [],
235235
"source": [
236-
"df[\"cat_type\"].cat.categories = [\"alpha\", \"beta\", \"gamma\"]\n",
237-
"df"
236+
"df[\"cat_type\"] = df[\"cat_type\"].cat.rename_categories([\"alpha\", \"beta\", \"gamma\"])"
238237
]
239238
},
240239
{
@@ -380,7 +379,7 @@
380379
"name": "python",
381380
"nbconvert_exporter": "python",
382381
"pygments_lexer": "ipython3",
383-
"version": "3.9.12"
382+
"version": "3.10.12"
384383
},
385384
"toc-showtags": true
386385
},

0 commit comments

Comments
 (0)