code: def get_columns(dataframe, name_regex):
      """Extract relevant columns from a dataframe.
  
      Args:
        dataframe: A dataframe.
        name_regex: Regex to use to match the columns of the dataframe.
  
      Returns:
        columns: A Numpy array of the extracted colums.
  
      Raise:
        ValueError: If no columns were matched.
      """
      col_selector = dataframe.columns.map(
          lambda s: bool(re.fullmatch(name_regex, s))
      )
      if not np.any(col_selector):
          raise ValueError(
              'Regex "{}" selected no params from {}'.format(
                  name_regex, dataframe.columns
              )
          )
      return np.array(dataframe.loc[:, col_selector])
  
file_path: probability/spinoffs/inference_gym/inference_gym/tools/stan/util.py
imports: import contextlib
  import glob
  import hashlib
  import os
  import re
  import shutil
  import tempfile
  from absl import flags
  import cmdstanpy
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: get_columns(dataframe, name_regex) and returns: np