Skip to content

Commit bfda276

Browse files
Sync introduction-combining-data-pandas-merge-join-and-concat with the maintenance update of Combining Data in pandas With merge(), .join(), and concat() (#946)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 6397294 commit bfda276

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎introduction-combining-data-pandas-merge-join-and-concat/pandas_merge.ipynb‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3749,7 +3749,7 @@
37493749
"Here, you simply flipped the positions of the input DataFrames and specified a right join. When you inspect `right_merged`, you might notice that it's not exactly the same as `left_merged`. The only difference between the two is the order of the columns: the first input's columns will always be the first in the newly formed DataFrame.\n",
37503750
"\n",
37513751
"## .join()\n",
3752-
"`.join()` uses `merge()` under the hood, but provides a much more simplified interface to `merge()` and by default joins on indexes. Here is an introductory example using the `lsuffix` and `rsuffix` parameters to handle overlapping column names."
3752+
"`.join()` uses `merge()` under the hood, but provides a much more simplified interface to `merge()` and by default joins on indexes. Here is an introductory example using the `suffixes` parameter to handle overlapping column names."
37533753
]
37543754
},
37553755
{
@@ -4637,7 +4637,7 @@
46374637
}
46384638
],
46394639
"source": [
4640-
"precip_one_station.join(climate_temp, lsuffix=\"_left\", rsuffix=\"_right\")"
4640+
"precip_one_station.join(climate_temp, suffixes=(\"_left\", \"_right\"))"
46414641
]
46424642
},
46434643
{
@@ -5532,7 +5532,7 @@
55325532
}
55335533
],
55345534
"source": [
5535-
"climate_temp.join(precip_one_station, lsuffix=\"_left\", rsuffix=\"_right\")"
5535+
"climate_temp.join(precip_one_station, suffixes=(\"_left\", \"_right\"))"
55365536
]
55375537
},
55385538
{
@@ -6422,8 +6422,7 @@
64226422
" climate_precip.set_index([\"STATION\", \"DATE\"]),\n",
64236423
" on=[\"STATION\", \"DATE\"],\n",
64246424
" how=\"inner\",\n",
6425-
" lsuffix=\"_x\",\n",
6426-
" rsuffix=\"_y\",\n",
6425+
" suffixes=(\"_x\", \"_y\"),\n",
64276426
")\n",
64286427
"inner_joined_total.head()"
64296428
]
@@ -6434,7 +6433,7 @@
64346433
"source": [
64356434
"Because `.join()` works on indexes, if we want to recreate `merge()` before, then we must set indexes on the join columns we specify. In this example, you used the `.set_index()` method to set your indexes to the key columns within the join. \n",
64366435
"\n",
6437-
"Below you will see an almost-bare `.join()` call. Because there are overlapping columns, you will have to specify a suffix with `lsuffix`, `rsuffix`, or both, but this example will demonstrate the more typical behavior of `.join()`."
6436+
"Below you will see an almost-bare `.join()` call. Because there are overlapping columns, you will have to specify at least one suffix with `suffixes`, but this example will demonstrate the more typical behavior of `.join()`."
64386437
]
64396438
},
64406439
{
@@ -7322,7 +7321,7 @@
73227321
}
73237322
],
73247323
"source": [
7325-
"climate_temp.join(climate_precip, lsuffix=\"_left\")"
7324+
"climate_temp.join(climate_precip, suffixes=(\"_left\", \"\"))"
73267325
]
73277326
},
73287327
{

0 commit comments

Comments
 (0)