code: def _sparse_data_to_array(
      arff_data: ArffSparseDataType, include_columns: List
  ) -> np.ndarray:
      # turns the sparse data back into an array (can't use toarray() function,
      # as this does only work on numeric data)
      num_obs = max(arff_data[1]) + 1
      y_shape = (num_obs, len(include_columns))
      reindexed_columns = {
          column_idx: array_idx
          for array_idx, column_idx in enumerate(include_columns)
      }
      # TODO: improve for efficiency
      y = np.empty(y_shape, dtype=np.float64)
      for val, row_idx, col_idx in zip(
          arff_data[0], arff_data[1], arff_data[2]
      ):
          if col_idx in include_columns:
              y[row_idx, reindexed_columns[col_idx]] = val
      return y
  
file_path: scikit-learn/sklearn/datasets/_arff_parser.py
imports: import itertools
  import re
  from collections import OrderedDict
  from collections.abc import Generator
  from typing import List
  import numpy
  import scipy
  from ..externals import _arff
  from ..externals._arff import ArffSparseDataType
  from ..utils import _chunk_generator, check_pandas_support, get_chunk_n_rows
  from ..utils.fixes import pd_fillna
label_desc: Use image node_id 2 for calling a global function with example usage: _sparse_data_to_array(arff_data, include_columns) and returns: y