|
3749 | 3749 | "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", |
3750 | 3750 | "\n", |
3751 | 3751 | "## .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." |
3753 | 3753 | ] |
3754 | 3754 | }, |
3755 | 3755 | { |
|
4637 | 4637 | } |
4638 | 4638 | ], |
4639 | 4639 | "source": [ |
4640 | | - "precip_one_station.join(climate_temp, lsuffix=\"_left\", rsuffix=\"_right\")" |
| 4640 | + "precip_one_station.join(climate_temp, suffixes=(\"_left\", \"_right\"))" |
4641 | 4641 | ] |
4642 | 4642 | }, |
4643 | 4643 | { |
|
5532 | 5532 | } |
5533 | 5533 | ], |
5534 | 5534 | "source": [ |
5535 | | - "climate_temp.join(precip_one_station, lsuffix=\"_left\", rsuffix=\"_right\")" |
| 5535 | + "climate_temp.join(precip_one_station, suffixes=(\"_left\", \"_right\"))" |
5536 | 5536 | ] |
5537 | 5537 | }, |
5538 | 5538 | { |
|
6422 | 6422 | " climate_precip.set_index([\"STATION\", \"DATE\"]),\n", |
6423 | 6423 | " on=[\"STATION\", \"DATE\"],\n", |
6424 | 6424 | " how=\"inner\",\n", |
6425 | | - " lsuffix=\"_x\",\n", |
6426 | | - " rsuffix=\"_y\",\n", |
| 6425 | + " suffixes=(\"_x\", \"_y\"),\n", |
6427 | 6426 | ")\n", |
6428 | 6427 | "inner_joined_total.head()" |
6429 | 6428 | ] |
|
6434 | 6433 | "source": [ |
6435 | 6434 | "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", |
6436 | 6435 | "\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()`." |
6438 | 6437 | ] |
6439 | 6438 | }, |
6440 | 6439 | { |
|
7322 | 7321 | } |
7323 | 7322 | ], |
7324 | 7323 | "source": [ |
7325 | | - "climate_temp.join(climate_precip, lsuffix=\"_left\")" |
| 7324 | + "climate_temp.join(climate_precip, suffixes=(\"_left\", \"\"))" |
7326 | 7325 | ] |
7327 | 7326 | }, |
7328 | 7327 | { |
|
0 commit comments