@@ -562,7 +562,7 @@ all standard database join operations between ``DataFrame`` or named ``Series``
562
562
(hierarchical), the number of levels must match the number of join keys
563
563
from the right DataFrame or Series.
564
564
* ``right_index ``: Same usage as ``left_index `` for the right DataFrame or Series
565
- * ``how ``: One of ``'left' ``, ``'right' ``, ``'outer' ``, ``'inner' ``. Defaults
565
+ * ``how ``: One of ``'left' ``, ``'right' ``, ``'outer' ``, ``'inner' ``, `` 'cross' `` . Defaults
566
566
to ``inner ``. See below for more detailed description of each method.
567
567
* ``sort ``: Sort the result DataFrame by the join keys in lexicographical
568
568
order. Defaults to ``True ``, setting to ``False `` will improve performance
@@ -707,6 +707,7 @@ either the left or right tables, the values in the joined table will be
707
707
``right ``, ``RIGHT OUTER JOIN ``, Use keys from right frame only
708
708
``outer ``, ``FULL OUTER JOIN ``, Use union of keys from both frames
709
709
``inner ``, ``INNER JOIN ``, Use intersection of keys from both frames
710
+ ``cross ``, ``CROSS JOIN ``, Create the cartesian product of rows of both frames
710
711
711
712
.. ipython :: python
712
713
@@ -751,6 +752,17 @@ either the left or right tables, the values in the joined table will be
751
752
p.plot([left, right], result, labels = [" left" , " right" ], vertical = False );
752
753
plt.close(" all" );
753
754
755
+ .. ipython :: python
756
+
757
+ result = pd.merge(left, right, how = " cross" )
758
+
759
+ .. ipython :: python
760
+ :suppress:
761
+
762
+ @savefig merging_merge_cross.png
763
+ p.plot([left, right], result, labels = [" left" , " right" ], vertical = False );
764
+ plt.close(" all" );
765
+
754
766
You can merge a mult-indexed Series and a DataFrame, if the names of
755
767
the MultiIndex correspond to the columns from the DataFrame. Transform
756
768
the Series to a DataFrame using :meth: `Series.reset_index ` before merging,
0 commit comments