code: def _flatten_dims(data, space):
      for key, dim in space.items():
          if dim.shape:
              assert len(dim.shape) == 1
  
              # expand df.tags into its own dataframe
              values = data[key].apply(pd.Series)
  
              # rename each hp
              values = values.rename(columns=lambda x: f"{key}[{x}]")
  
              data = pd.concat([data[:], values[:]], axis=1)
  
      return data
  
imports: import functools
  from collections.abc import Iterable
  import numpy
  import pandas
  import plotly.express
  import plotly.graph_objects
  from plotly.subplots import make_subplots
  import orion.analysis
  import orion.analysis.base
  from orion.algo.space import Categorical, Fidelity
  from orion.core.worker.transformer import build_required_space
label_desc: Use image node_id 17 for calling a global function with example usage: _flatten_dims(data, space) and returns: data