@@ -6440,19 +6440,19 @@ def append(self, other, ignore_index=False,
6440
6440
def join (self , other , on = None , how = 'left' , lsuffix = '' , rsuffix = '' ,
6441
6441
sort = False ):
6442
6442
"""
6443
- Append columns of another DataFrame.
6443
+ Join columns of another DataFrame.
6444
6444
6445
6445
Join columns with other DataFrame either on index or on a key
6446
6446
column. Efficiently Join multiple DataFrame objects by index at once by
6447
6447
passing a list.
6448
6448
6449
6449
Parameters
6450
6450
----------
6451
- other : DataFrame, Series with name field set , or list of DataFrame
6451
+ other : DataFrame, Series, or list of DataFrame
6452
6452
Index should be similar to one of the columns in this one. If a
6453
6453
Series is passed, its name attribute must be set, and that will be
6454
6454
used as the column name in the resulting joined DataFrame.
6455
- on : name, tuple/ list of names , or array-like
6455
+ on : str, list of str , or array-like
6456
6456
Column or index level name(s) in the caller to join on the index
6457
6457
in `other`, otherwise joins index-on-index. If multiple
6458
6458
values given, the `other` DataFrame must have a MultiIndex. Can
@@ -6469,11 +6469,11 @@ def join(self, other, on=None, how='left', lsuffix='', rsuffix='',
6469
6469
* inner: form intersection of calling frame's index (or column if
6470
6470
on is specified) with other frame's index, preserving the order
6471
6471
of the calling's one.
6472
- lsuffix : string
6472
+ lsuffix : str
6473
6473
Suffix to use from left frame's overlapping columns.
6474
- rsuffix : string
6474
+ rsuffix : str
6475
6475
Suffix to use from right frame's overlapping columns.
6476
- sort : boolean , default False
6476
+ sort : bool , default False
6477
6477
Order result DataFrame lexicographically by the join key. If False,
6478
6478
the order of the join key depends on the join type (how keyword).
6479
6479
@@ -6485,14 +6485,17 @@ def join(self, other, on=None, how='left', lsuffix='', rsuffix='',
6485
6485
Support for specifying index levels as the `on` parameter was added
6486
6486
in version 0.23.0
6487
6487
6488
+ See Also
6489
+ --------
6490
+ DataFrame.merge : For column(s)-on-columns(s) operations.
6491
+
6488
6492
Examples
6489
6493
--------
6490
- >>> import pandas as pd
6491
6494
6492
- >>> caller = pd.DataFrame({'key': ['K0', 'K1', 'K2', 'K3', 'K4', 'K5'],
6495
+ >>> df = pd.DataFrame({'key': ['K0', 'K1', 'K2', 'K3', 'K4', 'K5'],
6493
6496
... 'A': ['A0', 'A1', 'A2', 'A3', 'A4', 'A5']})
6494
6497
6495
- >>> caller
6498
+ >>> df
6496
6499
key A
6497
6500
0 K0 A0
6498
6501
1 K1 A1
@@ -6512,7 +6515,7 @@ def join(self, other, on=None, how='left', lsuffix='', rsuffix='',
6512
6515
6513
6516
Join DataFrames using their indexes.
6514
6517
6515
- >>> caller .join(other, lsuffix='_caller', rsuffix='_other')
6518
+ >>> df .join(other, lsuffix='_caller', rsuffix='_other')
6516
6519
key_caller A key_other B
6517
6520
0 K0 A0 K0 B0
6518
6521
1 K1 A1 K1 B1
@@ -6522,10 +6525,10 @@ def join(self, other, on=None, how='left', lsuffix='', rsuffix='',
6522
6525
5 K5 A5 NaN NaN
6523
6526
6524
6527
If we want to join using the key columns, we need to set key to be
6525
- the index in both caller and other. The joined DataFrame will have
6528
+ the index in both df and other. The joined DataFrame will have
6526
6529
key as its index.
6527
6530
6528
- >>> caller .set_index('key').join(other.set_index('key'))
6531
+ >>> df .set_index('key').join(other.set_index('key'))
6529
6532
A B
6530
6533
key
6531
6534
K0 A0 B0
@@ -6537,10 +6540,10 @@ def join(self, other, on=None, how='left', lsuffix='', rsuffix='',
6537
6540
6538
6541
Another option to join using the key columns is to use the on
6539
6542
parameter. DataFrame.join always uses other's index but we can use any
6540
- column in the caller . This method preserves the original caller 's
6543
+ column in df . This method preserves the original DataFrame 's
6541
6544
index in the result.
6542
6545
6543
- >>> caller .join(other.set_index('key'), on='key')
6546
+ >>> df .join(other.set_index('key'), on='key')
6544
6547
key A B
6545
6548
0 K0 A0 B0
6546
6549
1 K1 A1 B1
@@ -6549,10 +6552,6 @@ def join(self, other, on=None, how='left', lsuffix='', rsuffix='',
6549
6552
4 K4 A4 NaN
6550
6553
5 K5 A5 NaN
6551
6554
6552
- See also
6553
- --------
6554
- DataFrame.merge : For column(s)-on-columns(s) operations
6555
-
6556
6555
Returns
6557
6556
-------
6558
6557
joined : DataFrame
0 commit comments