class_docstr: UMAP Mixin for automagic UMAPing
class_docstr_tok: ["UMAP","Mixin","for","automagic","UMAPing"]
code: def _bundle_embedding(self, emb, index):
      # Converts Embedding into dataframe and takes care if emb.dim > 2
      if (
          emb.shape[1] == 2
          and "cudf.core.dataframe" not in str(getmodule(emb))
          and not hasattr(emb, "device")
      ):
          emb = pd.DataFrame(
              emb, columns=[config.X, config.Y], index=index
          )
      elif emb.shape[1] == 2 and "cudf.core.dataframe" in str(
          getmodule(emb)
      ):
          emb.rename(columns={0: config.X, 1: config.Y}, inplace=True)
      elif emb.shape[1] == 2 and hasattr(emb, "device"):
          import cudf
  
          emb = cudf.DataFrame(
              emb, columns=[config.X, config.Y], index=index
          )
      else:
          columns = [config.X, config.Y] + [
              f"umap_{k}" for k in range(2, emb.shape[1])
          ]
          if "cudf.core.dataframe" not in str(getmodule(emb)):
              emb = pd.DataFrame(emb, columns=columns, index=index)
          elif "cudf.core.dataframe" in str(getmodule(emb)):
              emb.columns = columns
      return emb
  
imports: import copy
  from time import time
  from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple, Union
  from inspect import getmodule
  import pandas
  from .None import constants
  from .constants import CUML, UMAP_LEARN
  from .feature_utils import FeatureMixin, Literal, XSymbolic, YSymbolic, prune_weighted_edges_df_and_relabel_nodes, resolve_feature_engine
  from .PlotterBase import Plottable, WeakValueDictionary
  from .util import check_set_memoize
  import logging
label_desc: Use image node_id 8 for calling the UMAPMixin obj's underlying member method code with example usage: obj._bundle_embedding(emb, index) and returns: emb