@@ -1469,7 +1469,7 @@ def __xor__(self, other):
14691469
14701470 def union (self , other ):
14711471 """
1472- Form the union of two Index objects and sorts if possible
1472+ Form the union of two Index objects and sorts if possible.
14731473
14741474 Parameters
14751475 ----------
@@ -1478,6 +1478,15 @@ def union(self, other):
14781478 Returns
14791479 -------
14801480 union : Index
1481+
1482+ Examples
1483+ --------
1484+
1485+ >>> idx1 = pd.Index([1, 2, 3, 4])
1486+ >>> idx2 = pd.Index([3, 4, 5, 6])
1487+ >>> idx1.union(idx2)
1488+ Int64Index([1, 2, 3, 4, 5, 6], dtype='int64')
1489+
14811490 """
14821491 self ._assert_can_do_setop (other )
14831492 other = _ensure_index (other )
@@ -1545,8 +1554,10 @@ def _wrap_union_result(self, other, result):
15451554
15461555 def intersection (self , other ):
15471556 """
1548- Form the intersection of two Index objects. Sortedness of the result is
1549- not guaranteed
1557+ Form the intersection of two Index objects.
1558+
1559+ This returns a new Index with elements common to the index and `other`.
1560+ Sortedness of the result is not guaranteed.
15501561
15511562 Parameters
15521563 ----------
@@ -1555,6 +1566,15 @@ def intersection(self, other):
15551566 Returns
15561567 -------
15571568 intersection : Index
1569+
1570+ Examples
1571+ --------
1572+
1573+ >>> idx1 = pd.Index([1, 2, 3, 4])
1574+ >>> idx2 = pd.Index([3, 4, 5, 6])
1575+ >>> idx1.intersection(idx2)
1576+ Int64Index([3, 4], dtype='int64')
1577+
15581578 """
15591579 self ._assert_can_do_setop (other )
15601580 other = _ensure_index (other )
@@ -1589,21 +1609,26 @@ def intersection(self, other):
15891609
15901610 def difference (self , other ):
15911611 """
1592- Compute sorted set difference of two Index objects
1612+ Return a new Index with elements from the index that are not in `other`.
1613+
1614+ This is the sorted set difference of two Index objects.
15931615
15941616 Parameters
15951617 ----------
15961618 other : Index or array-like
15971619
15981620 Returns
15991621 -------
1600- diff : Index
1622+ difference : Index
16011623
1602- Notes
1603- -----
1604- One can do either of these and achieve the same result
1624+ Examples
1625+ --------
1626+
1627+ >>> idx1 = pd.Index([1, 2, 3, 4])
1628+ >>> idx2 = pd.Index([3, 4, 5, 6])
1629+ >>> idx1.difference(idx2)
1630+ Int64Index([1, 2], dtype='int64')
16051631
1606- >>> index.difference(index2)
16071632 """
16081633 self ._assert_can_do_setop (other )
16091634
@@ -1623,7 +1648,6 @@ def sym_diff(self, other, result_name=None):
16231648
16241649 Parameters
16251650 ----------
1626-
16271651 other : Index or array-like
16281652 result_name : str
16291653
0 commit comments