File tree Expand file tree Collapse file tree 2 files changed +14
-44
lines changed Expand file tree Collapse file tree 2 files changed +14
-44
lines changed Original file line number Diff line number Diff line change 518
518
}
519
519
],
520
520
"source" : [
521
- " taxis.rename(\n " ,
521
+ " taxis = taxis .rename(\n " ,
522
522
" columns={\n " ,
523
523
" 'tpep_pickup_datetime': 'pickup', \n " ,
524
524
" 'tpep_dropoff_datetime': 'dropoff'\n " ,
525
- " },\n " ,
526
- " inplace=True\n " ,
525
+ " }\n " ,
527
526
" )\n " ,
528
527
" taxis.columns"
529
528
]
530
529
},
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
- },
544
530
{
545
531
"cell_type" : " markdown" ,
546
532
"id" : " d74d21a8-d733-4afa-a140-29ccdcd83b46" ,
1440
1426
}
1441
1427
],
1442
1428
"source" : [
1443
- " taxis.set_index('pickup', inplace=True )\n " ,
1429
+ " taxis = taxis .set_index('pickup')\n " ,
1444
1430
" taxis.head(3)"
1445
1431
]
1446
1432
},
1464
1450
"metadata" : {},
1465
1451
"outputs" : [],
1466
1452
"source" : [
1467
- " taxis.sort_index(inplace=True )"
1453
+ " taxis = taxis .sort_index()"
1468
1454
]
1469
1455
},
1470
1456
{
2033
2019
}
2034
2020
],
2035
2021
"source" : [
2036
- " taxis.reset_index(inplace=True )\n " ,
2022
+ " taxis = taxis .reset_index()\n " ,
2037
2023
" taxis.head()"
2038
2024
]
2039
2025
},
4594
4580
"metadata" : {},
4595
4581
"outputs" : [],
4596
4582
"source" : [
4597
- " taxis.set_index('dropoff', inplace=True)\n " ,
4598
- " taxis.sort_index(inplace=True)"
4583
+ " taxis = taxis.set_index('dropoff').sort_index()"
4599
4584
]
4600
4585
},
4601
4586
{
5392
5377
"metadata" : {},
5393
5378
"outputs" : [],
5394
5379
"source" : [
5395
- " tsa_melted_holiday_travel.set_index('date', inplace=True )"
5380
+ " tsa_melted_holiday_travel = tsa_melted_holiday_travel .set_index('date')"
5396
5381
]
5397
5382
},
5398
5383
{
Original file line number Diff line number Diff line change 550
550
}
551
551
],
552
552
"source" : [
553
- " taxis.rename(\n " ,
553
+ " taxis = taxis .rename(\n " ,
554
554
" columns={\n " ,
555
555
" 'tpep_pickup_datetime': 'pickup', \n " ,
556
556
" 'tpep_dropoff_datetime': 'dropoff'\n " ,
557
- " },\n " ,
558
- " inplace=True\n " ,
557
+ " }\n " ,
559
558
" )\n " ,
560
559
" taxis.columns"
561
560
]
562
561
},
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
- },
576
562
{
577
563
"cell_type" : " markdown" ,
578
564
"id" : " 0750fd20-a823-4eed-961c-d3f0cf9a18aa" ,
1639
1625
}
1640
1626
],
1641
1627
"source" : [
1642
- " taxis.set_index('pickup', inplace=True )\n " ,
1628
+ " taxis = taxis .set_index('pickup')\n " ,
1643
1629
" taxis.head(3)"
1644
1630
]
1645
1631
},
1665
1651
"metadata" : {},
1666
1652
"outputs" : [],
1667
1653
"source" : [
1668
- " taxis.sort_index(inplace=True )"
1654
+ " taxis = taxis .sort_index()"
1669
1655
]
1670
1656
},
1671
1657
{
2238
2224
}
2239
2225
],
2240
2226
"source" : [
2241
- " taxis.reset_index(inplace=True )\n " ,
2227
+ " taxis = taxis .reset_index()\n " ,
2242
2228
" taxis.head()"
2243
2229
]
2244
2230
},
5452
5438
"metadata" : {},
5453
5439
"outputs" : [],
5454
5440
"source" : [
5455
- " taxis.set_index('dropoff', inplace=True)\n " ,
5456
- " taxis.sort_index(inplace=True)"
5441
+ " taxis = taxis.set_index('dropoff').sort_index()"
5457
5442
]
5458
5443
},
5459
5444
{
6254
6239
"metadata" : {},
6255
6240
"outputs" : [],
6256
6241
"source" : [
6257
- " tsa_melted_holiday_travel.set_index('date', inplace=True )"
6242
+ " tsa_melted_holiday_travel = tsa_melted_holiday_travel .set_index('date')"
6258
6243
]
6259
6244
},
6260
6245
{
You can’t perform that action at this time.
0 commit comments