Skip to content

Commit fbeb5d0

Browse files
committed
Remove inplace argument everywhere.
1 parent 813f0b3 commit fbeb5d0

File tree

2 files changed

+14
-44
lines changed

2 files changed

+14
-44
lines changed

notebooks/2-data_wrangling.ipynb

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -518,29 +518,15 @@
518518
}
519519
],
520520
"source": [
521-
"taxis.rename(\n",
521+
"taxis = taxis.rename(\n",
522522
" columns={\n",
523523
" 'tpep_pickup_datetime': 'pickup', \n",
524524
" 'tpep_dropoff_datetime': 'dropoff'\n",
525-
" },\n",
526-
" inplace=True\n",
525+
" }\n",
527526
")\n",
528527
"taxis.columns"
529528
]
530529
},
531-
{
532-
"cell_type": "markdown",
533-
"id": "5c28403d-34f9-4c9c-a61e-3ad43a30e0dc",
534-
"metadata": {
535-
"slideshow": {
536-
"slide_type": "fragment"
537-
},
538-
"tags": []
539-
},
540-
"source": [
541-
"**Important**: This operation was performed in-place – be careful with in-place operations."
542-
]
543-
},
544530
{
545531
"cell_type": "markdown",
546532
"id": "d74d21a8-d733-4afa-a140-29ccdcd83b46",
@@ -1440,7 +1426,7 @@
14401426
}
14411427
],
14421428
"source": [
1443-
"taxis.set_index('pickup', inplace=True)\n",
1429+
"taxis = taxis.set_index('pickup')\n",
14441430
"taxis.head(3)"
14451431
]
14461432
},
@@ -1464,7 +1450,7 @@
14641450
"metadata": {},
14651451
"outputs": [],
14661452
"source": [
1467-
"taxis.sort_index(inplace=True)"
1453+
"taxis = taxis.sort_index()"
14681454
]
14691455
},
14701456
{
@@ -2033,7 +2019,7 @@
20332019
}
20342020
],
20352021
"source": [
2036-
"taxis.reset_index(inplace=True)\n",
2022+
"taxis = taxis.reset_index()\n",
20372023
"taxis.head()"
20382024
]
20392025
},
@@ -4594,8 +4580,7 @@
45944580
"metadata": {},
45954581
"outputs": [],
45964582
"source": [
4597-
"taxis.set_index('dropoff', inplace=True)\n",
4598-
"taxis.sort_index(inplace=True)"
4583+
"taxis = taxis.set_index('dropoff').sort_index()"
45994584
]
46004585
},
46014586
{
@@ -5392,7 +5377,7 @@
53925377
"metadata": {},
53935378
"outputs": [],
53945379
"source": [
5395-
"tsa_melted_holiday_travel.set_index('date', inplace=True)"
5380+
"tsa_melted_holiday_travel = tsa_melted_holiday_travel.set_index('date')"
53965381
]
53975382
},
53985383
{

slides/2-data_wrangling.ipynb

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -550,29 +550,15 @@
550550
}
551551
],
552552
"source": [
553-
"taxis.rename(\n",
553+
"taxis = taxis.rename(\n",
554554
" columns={\n",
555555
" 'tpep_pickup_datetime': 'pickup', \n",
556556
" 'tpep_dropoff_datetime': 'dropoff'\n",
557-
" },\n",
558-
" inplace=True\n",
557+
" }\n",
559558
")\n",
560559
"taxis.columns"
561560
]
562561
},
563-
{
564-
"cell_type": "markdown",
565-
"id": "f6a822aa-c9cc-474e-afff-057d456f6fc3",
566-
"metadata": {
567-
"slideshow": {
568-
"slide_type": "fragment"
569-
},
570-
"tags": []
571-
},
572-
"source": [
573-
"**Important**: This operation was performed in-place – be careful with in-place operations."
574-
]
575-
},
576562
{
577563
"cell_type": "markdown",
578564
"id": "0750fd20-a823-4eed-961c-d3f0cf9a18aa",
@@ -1639,7 +1625,7 @@
16391625
}
16401626
],
16411627
"source": [
1642-
"taxis.set_index('pickup', inplace=True)\n",
1628+
"taxis = taxis.set_index('pickup')\n",
16431629
"taxis.head(3)"
16441630
]
16451631
},
@@ -1665,7 +1651,7 @@
16651651
"metadata": {},
16661652
"outputs": [],
16671653
"source": [
1668-
"taxis.sort_index(inplace=True)"
1654+
"taxis = taxis.sort_index()"
16691655
]
16701656
},
16711657
{
@@ -2238,7 +2224,7 @@
22382224
}
22392225
],
22402226
"source": [
2241-
"taxis.reset_index(inplace=True)\n",
2227+
"taxis = taxis.reset_index()\n",
22422228
"taxis.head()"
22432229
]
22442230
},
@@ -5452,8 +5438,7 @@
54525438
"metadata": {},
54535439
"outputs": [],
54545440
"source": [
5455-
"taxis.set_index('dropoff', inplace=True)\n",
5456-
"taxis.sort_index(inplace=True)"
5441+
"taxis = taxis.set_index('dropoff').sort_index()"
54575442
]
54585443
},
54595444
{
@@ -6254,7 +6239,7 @@
62546239
"metadata": {},
62556240
"outputs": [],
62566241
"source": [
6257-
"tsa_melted_holiday_travel.set_index('date', inplace=True)"
6242+
"tsa_melted_holiday_travel = tsa_melted_holiday_travel.set_index('date')"
62586243
]
62596244
},
62606245
{

0 commit comments

Comments
 (0)