docstr: Manage the merging of two Frames.
  
  Parameters
  ----------
  lhs : DataFrame
      The left operand of the merge
  rhs : DataFrame
      The right operand of the merge
  on : string or list like
      A set of key columns in the left and right operands
      elements must be common to both frames
  left_on : string or list like
      A set of key columns in the left operand. Must be
      specified with right_on or right_index concurrently
  right_on : string or list like
      A set of key columns in the right operand. Must be
      specified with left_on or left_index concurrently
  left_index : bool
      Boolean flag indicating the left index column or columns
      are to be used as join keys in order.
  right_index : bool
      Boolean flag indicating the right index column or columns
      are to be used as join keys in order.
  how : string
      The type of join. Possible values are
      'inner', 'outer', 'left', 'leftsemi' and 'leftanti'
  sort : bool
      Boolean flag indicating if the output Frame is to be
      sorted on the output's join keys, in left to right order.
  suffixes : list like
      Left and right suffixes specified together, unpacked into lsuffix
      and rsuffix.
docstr_tok: ["Manage","the","merging","of","two","Frames",".","Parameters","--","--","--","--","--","lhs",":","DataFrame","The","left","operand","of","the","merge","rhs",":","DataFrame","The","right","operand","of","the","merge","on",":","string","or","list","like","A","set","of","key","columns","in","the","left","and","right","operands","elements","must","be","common","to","both","frames","left_on",":","string","or","list","like","A","set","of","key","columns","in","the","left","operand",".","Must","be","specified","with","right_on","or","right_index","concurrently","right_on",":","string","or","list","like","A","set","of","key","columns","in","the","right","operand",".","Must","be","specified","with","left_on","or","left_index","concurrently","left_index",":","bool","Boolean","flag","indicating","the","left","index","column","or","columns","are","to","be","used","as","join","keys","in","order",".","right_index",":","bool","Boolean","flag","indicating","the","right","index","column","or","columns","are","to","be","used","as","join","keys","in","order",".","how",":","string","The","type","of","join",".","Possible","values","are","'inner","'",",","'outer","'",",","'left","'",",","'leftsemi","'","and","'leftanti'","sort",":","bool","Boolean","flag","indicating","if","the","output","Frame","is","to","be","sorted","on","the","output","'s","join","keys",",","in","left","to","right","order",".","suffixes",":","list","like","Left","and","right","suffixes","specified","together",",","unpacked","into","lsuffix","and","rsuffix","."]
code: def __init__(
      self,
      lhs,
      rhs,
      *,
      on,
      left_on,
      right_on,
      left_index,
      right_index,
      how,
      sort,
      indicator,
      suffixes,
  ):
      """
      Manage the merging of two Frames.
  
      Parameters
      ----------
      lhs : DataFrame
          The left operand of the merge
      rhs : DataFrame
          The right operand of the merge
      on : string or list like
          A set of key columns in the left and right operands
          elements must be common to both frames
      left_on : string or list like
          A set of key columns in the left operand. Must be
          specified with right_on or right_index concurrently
      right_on : string or list like
          A set of key columns in the right operand. Must be
          specified with left_on or left_index concurrently
      left_index : bool
          Boolean flag indicating the left index column or columns
          are to be used as join keys in order.
      right_index : bool
          Boolean flag indicating the right index column or columns
          are to be used as join keys in order.
      how : string
          The type of join. Possible values are
          'inner', 'outer', 'left', 'leftsemi' and 'leftanti'
      sort : bool
          Boolean flag indicating if the output Frame is to be
          sorted on the output's join keys, in left to right order.
      suffixes : list like
          Left and right suffixes specified together, unpacked into lsuffix
          and rsuffix.
      """
      self._validate_merge_params(
          lhs,
          rhs,
          on=on,
          left_on=left_on,
          right_on=right_on,
          left_index=left_index,
          right_index=right_index,
          how=how,
          suffixes=suffixes,
      )
  
      self.lhs = lhs.copy(deep=False)
      self.rhs = rhs.copy(deep=False)
      self.how = how
      # If the user requests that the result is sorted or we're in
      # pandas-compatible mode we have various obligations on the
      # output order:
      #
      # compat-> | False                    | True
      # sort     |                          |
      # ---------+--------------------------+-------------------------------
      #     False| no obligation            | ordering as per pandas docs(*)
      #     True | sorted lexicographically | sorted lexicographically(*)
      #
      # (*) If two keys are equal, tiebreak is to use input table order.
      #
      # In pandas-compat mode, we have obligations on the order to
      # match pandas (even if sort=False), see
      # pandas.pydata.org/docs/reference/api/pandas.DataFrame.merge.html.
      # The ordering requirements differ depending on which join
      # type is specified:
      #
      # - left: preserve key order (only keeping left keys)
      # - right: preserve key order (only keeping right keys)
      # - inner: preserve key order (of left keys)
      # - outer: sort keys lexicographically
      # - cross (not supported): preserve key order (of left keys)
      #
      # Moreover, in all cases, whenever there is a tiebreak
      # situation (for sorting or otherwise), the deciding order is
      # "input table order"
      self.sort = sort or (
          cudf.get_option("mode.pandas_compatible") and how == "outer"
      )
      self.preserve_key_order = cudf.get_option(
          "mode.pandas_compatible"
      ) and how in {
          "inner",
          "outer",
          "left",
          "right",
      }
      self.lsuffix, self.rsuffix = suffixes
  
      # At this point validation guarantees that if on is not None we
      # don't have any other args, so we can apply it directly to left_on and
      # right_on.
      self._using_left_index = bool(left_index)
      left_on = (
          lhs.index._data.names
          if left_index
          else left_on
          if left_on
          else on
      )
      self._using_right_index = bool(right_index)
      right_on = (
          rhs.index._data.names
          if right_index
          else right_on
          if right_on
          else on
      )
  
      if left_on or right_on:
          self._left_keys = [
              _ColumnIndexer(name=on)
              if not self._using_left_index and on in lhs._data
              else _IndexIndexer(name=on)
              for on in (_coerce_to_tuple(left_on) if left_on else [])
          ]
          self._right_keys = [
              _ColumnIndexer(name=on)
              if not self._using_right_index and on in rhs._data
              else _IndexIndexer(name=on)
              for on in (_coerce_to_tuple(right_on) if right_on else [])
          ]
          if len(self._left_keys) != len(self._right_keys):
              raise ValueError(
                  "Merge operands must have same number of join key columns"
              )
          self._using_left_index = any(
              isinstance(idx, _IndexIndexer) for idx in self._left_keys
          )
          self._using_right_index = any(
              isinstance(idx, _IndexIndexer) for idx in self._right_keys
          )
      else:
          # if `on` is not provided and we're not merging
          # index with column or on both indexes, then use
          # the intersection  of columns in both frames
          on_names = set(lhs._data) & set(rhs._data)
          self._left_keys = [_ColumnIndexer(name=on) for on in on_names]
          self._right_keys = [
              _ColumnIndexer(name=on) for on in on_names
          ]
          self._using_left_index = False
          self._using_right_index = False
  
      self._key_columns_with_same_name = (
          set(_coerce_to_tuple(on))
          if on
          else {
              lkey.name
              for lkey, rkey in zip(self._left_keys, self._right_keys)
              if lkey.name == rkey.name
              and not (
                  isinstance(lkey, _IndexIndexer)
                  or isinstance(rkey, _IndexIndexer)
              )
          }
      )
  
file_path: cudf/python/cudf/cudf/core/join/join.py
imports: from __future__ import annotations
  import itertools
  import warnings
  from typing import Any, ClassVar, List, Optional
  import cudf
  from cudf import _lib
  from cudf._lib.types import size_type_dtype
  from cudf.core.copy_types import GatherMap
  from cudf.core.join._join_helpers import _coerce_to_tuple, _ColumnIndexer, _IndexIndexer, _match_join_keys
label_desc: Use image node_id 1 to create a new Merge object  with example: obj = Merge(lhs, rhs)