code: def get_dummies(
      data,
      prefix=None,
      prefix_sep="_",
      dummy_na=False,
      columns=None,
      sparse=False,
      drop_first=False,
      dtype=None,
  ):
      """
      Convert categorical variable into dummy/indicator variables
  
      Parameters
      ----------
      data : array-like, Series, or DataFrame
      prefix : string, list of strings, or dict of strings, default None
          String to append DataFrame column names.
          Pass a list with length equal to the number of columns
          when calling get_dummies on a DataFrame. Alternatively, `prefix`
          can be a dictionary mapping column names to prefixes.
      prefix_sep : string, default '_'
          If appending prefix, separator/delimiter to use. Or pass a
          list or dictionary as with `prefix.`
      dummy_na : bool, default False
          Add a column to indicate NaNs, if False NaNs are ignored.
      columns : list-like, default None
          Column names in the DataFrame to be encoded.
          If `columns` is None then all the columns with
          `object` or `category` dtype will be converted.
      sparse : bool, default False
          Whether the dummy-encoded columns should be be backed by
          a :class:`SparseArray` (True) or a regular NumPy array (False).
      drop_first : bool, default False
          Whether to get k-1 dummies out of k categorical levels by removing the
          first level.
  
          .. versionadded:: 0.18.0
  
      dtype : dtype, default np.uint8
          Data type for new columns. Only a single dtype is allowed.
  
          .. versionadded:: 0.23.0
  
      Returns
      -------
      dummies : DataFrame
  
      See Also
      --------
      Series.str.get_dummies
  
      Examples
      --------
      >>> s = pd.Series(list('abca'))
  
      >>> pd.get_dummies(s)
         a  b  c
      0  1  0  0
      1  0  1  0
      2  0  0  1
      3  1  0  0
  
      >>> s1 = ['a', 'b', np.nan]
  
      >>> pd.get_dummies(s1)
         a  b
      0  1  0
      1  0  1
      2  0  0
  
      >>> pd.get_dummies(s1, dummy_na=True)
         a  b  NaN
      0  1  0    0
      1  0  1    0
      2  0  0    1
  
      >>> df = pd.DataFrame({'A': ['a', 'b', 'a'], 'B': ['b', 'a', 'c'],
      ...                    'C': [1, 2, 3]})
  
      >>> pd.get_dummies(df, prefix=['col1', 'col2'])
         C  col1_a  col1_b  col2_a  col2_b  col2_c
      0  1       1       0       0       1       0
      1  2       0       1       1       0       0
      2  3       1       0       0       0       1
  
      >>> pd.get_dummies(pd.Series(list('abcaa')))
         a  b  c
      0  1  0  0
      1  0  1  0
      2  0  0  1
      3  1  0  0
      4  1  0  0
  
      >>> pd.get_dummies(pd.Series(list('abcaa')), drop_first=True)
         b  c
      0  0  0
      1  1  0
      2  0  1
      3  0  0
      4  0  0
  
      >>> pd.get_dummies(pd.Series(list('abc')), dtype=float)
           a    b    c
      0  1.0  0.0  0.0
      1  0.0  1.0  0.0
      2  0.0  0.0  1.0
      """
      from pandas.core.reshape.concat import concat
      from itertools import cycle
  
      dtypes_to_encode = ["object", "category"]
  
      if isinstance(data, DataFrame):
          # determine columns being encoded
          if columns is None:
              data_to_encode = data.select_dtypes(
                  include=dtypes_to_encode
              )
          else:
              data_to_encode = data[columns]
  
          # validate prefixes and separator to avoid silently dropping cols
          def check_len(item, name):
              len_msg = (
                  "Length of '{name}' ({len_item}) did not match the "
                  "length of the columns being encoded ({len_enc})."
              )
  
              if is_list_like(item):
                  if not len(item) == data_to_encode.shape[1]:
                      len_msg = len_msg.format(
                          name=name,
                          len_item=len(item),
                          len_enc=data_to_encode.shape[1],
                      )
                      raise ValueError(len_msg)
  
          check_len(prefix, "prefix")
          check_len(prefix_sep, "prefix_sep")
  
          if isinstance(prefix, compat.string_types):
              prefix = cycle([prefix])
          if isinstance(prefix, dict):
              prefix = [prefix[col] for col in data_to_encode.columns]
  
          if prefix is None:
              prefix = data_to_encode.columns
  
          # validate separators
          if isinstance(prefix_sep, compat.string_types):
              prefix_sep = cycle([prefix_sep])
          elif isinstance(prefix_sep, dict):
              prefix_sep = [
                  prefix_sep[col] for col in data_to_encode.columns
              ]
  
          if data_to_encode.shape == data.shape:
              # Encoding the entire df, do not prepend any dropped columns
              with_dummies = []
          elif columns is not None:
              # Encoding only cols specified in columns. Get all cols not in
              # columns to prepend to result.
              with_dummies = [data.drop(columns, axis=1)]
          else:
              # Encoding only object and category dtype columns. Get remaining
              # columns to prepend to result.
              with_dummies = [
                  data.select_dtypes(exclude=dtypes_to_encode)
              ]
  
          for col, pre, sep in zip(
              data_to_encode.iteritems(), prefix, prefix_sep
          ):
              # col is (column_name, column), use just column data here
              dummy = _get_dummies_1d(
                  col[1],
                  prefix=pre,
                  prefix_sep=sep,
                  dummy_na=dummy_na,
                  sparse=sparse,
                  drop_first=drop_first,
                  dtype=dtype,
              )
              with_dummies.append(dummy)
          result = concat(with_dummies, axis=1)
      else:
          result = _get_dummies_1d(
              data,
              prefix,
              prefix_sep,
              dummy_na,
              sparse=sparse,
              drop_first=drop_first,
              dtype=dtype,
          )
      return result
  
imports: from functools import partial
  import itertools
  import numpy
  from pandas._libs import algos, reshape
  from pandas._libs.sparse import IntIndex
  from pandas.compat import PY2, range, text_type, u, zip
  from pandas.core.dtypes.cast import maybe_promote
  from pandas.core.dtypes.common import ensure_platform_int, is_bool_dtype, is_extension_array_dtype, is_integer_dtype, is_list_like, is_object_dtype, needs_i8_conversion
  from pandas.core.dtypes.missing import notna
  from pandas import compat
  import pandas.core.algorithms
  from pandas.core.arrays import SparseArray
  from pandas.core.arrays.categorical import _factorize_from_iterable
  from pandas.core.frame import DataFrame
  from pandas.core.index import Index, MultiIndex
  from pandas.core.internals.arrays import extract_array
  from pandas.core.series import Series
  from pandas.core.sorting import compress_group_index, decons_obs_group_ids, get_compressed_ids, get_group_index
label_desc: Use image node_id 8 for calling a global function with example usage: get_dummies(data, prefix, prefix_sep, dummy_na, columns, sparse, drop_first, dtype) and returns: result