code: def _construct(
      x: np.ndarray, categories: np.ndarray
  ) -> scipy.sparse.csr_matrix:
      """Make a sparse matrix from an encoded array.
  
      >>> construct(np.array([0, 1, 0]), np.array([0, 1])).toarray()
      array([[1., 0.],
             [0., 1.],
             [1., 0.]])
      """
      data = np.ones(len(x))
      rows = np.arange(len(x))
      columns = x.ravel()
      return scipy.sparse.csr_matrix(
          (data, (rows, columns)), shape=(len(x), len(categories))
      )
  
imports: from __future__ import division
  from operator import getitem
  from typing import Optional, Union
  import dask.array
  import dask.dataframe
  import numpy
  import pandas
  import scipy.sparse
  import sklearn.preprocessing
  from sklearn.utils.validation import check_is_fitted
  from .._typing import ArrayLike, SeriesType
label_desc: Use image node_id 3 for calling a global function with example usage: _construct(x, categories) and returns: scipy