class_docstr: PipelineEngine class that computes each term independently.
  
  Parameters
  ----------
  get_loader : callable
      A function that is given a loadable term and returns a PipelineLoader
      to use to retrieve raw data for that term.
  asset_finder : zipline.assets.AssetFinder
      An AssetFinder instance.  We depend on the AssetFinder to determine
      which assets are in the top-level universe at any point in time.
  populate_initial_workspace : callable, optional
      A function which will be used to populate the initial workspace when
      computing a pipeline. See
      :func:`zipline.pipeline.engine.default_populate_initial_workspace`
      for more info.
  default_hooks : list, optional
      List of hooks that should be used to instrument all pipelines executed
      by this engine.
  
  See Also
  --------
  :func:`zipline.pipeline.engine.default_populate_initial_workspace`
class_docstr_tok: ["PipelineEngine","class","that","computes","each","term","independently",".","Parameters","--","--","--","--","--","get_loader",":","callable","A","function","that","is","given","a","loadable","term","and","returns","a","PipelineLoader","to","use","to","retrieve","raw","data","for","that","term",".","asset_finder",":","zipline.assets.AssetFinder","An","AssetFinder","instance",".","We","depend","on","the","AssetFinder","to","determine","which","assets","are","in","the","top-level","universe","at","any","point","in","time",".","populate_initial_workspace",":","callable",",","optional","A","function","which","will","be","used","to","populate","the","initial","workspace","when","computing","a","pipeline",".","See",":","func",":","`","zipline.pipeline.engine.default_populate_initial_workspace","`","for","more","info",".","default_hooks",":","list",",","optional","List","of","hooks","that","should","be","used","to","instrument","all","pipelines","executed","by","this","engine",".","See","Also","--","--","--","--",":","func",":","`","zipline.pipeline.engine.default_populate_initial_workspace","`"]
docstr: Convert raw computed pipeline results into a DataFrame for public APIs.
  
  Parameters
  ----------
  terms : dict[str -> Term]
      Dict mapping column names to terms.
  data : dict[str -> ndarray[ndim=2]]
      Dict mapping column names to computed results for those names.
  mask : ndarray[bool, ndim=2]
      Mask array of values to keep.
  dates : ndarray[datetime64, ndim=1]
      Row index for arrays `data` and `mask`
  assets : ndarray[int64, ndim=2]
      Column index for arrays `data` and `mask`
  
  Returns
  -------
  results : pd.DataFrame
      The indices of `results` are as follows:
  
      index : two-tiered MultiIndex of (date, asset).
          Contains an entry for each (date, asset) pair corresponding to
          a `True` value in `mask`.
      columns : Index of str
          One column per entry in `data`.
  
  If mask[date, asset] is True, then result.loc[(date, asset), colname]
  will contain the value of data[colname][date, asset].
docstr_tok: ["Convert","raw","computed","pipeline","results","into","a","DataFrame","for","public","APIs",".","Parameters","--","--","--","--","--","terms",":","dict","[","str","-",">","Term","]","Dict","mapping","column","names","to","terms",".","data",":","dict","[","str","-",">","ndarray","[","ndim=2","]","]","Dict","mapping","column","names","to","computed","results","for","those","names",".","mask",":","ndarray","[","bool",",","ndim=2","]","Mask","array","of","values","to","keep",".","dates",":","ndarray","[","datetime64",",","ndim=1","]","Row","index","for","arrays","`","data","`","and","`","mask","`","assets",":","ndarray","[","int64",",","ndim=2","]","Column","index","for","arrays","`","data","`","and","`","mask","`","Returns","--","--","--","-","results",":","pd.DataFrame","The","indices","of","`","results","`","are","as","follows",":","index",":","two-tiered","MultiIndex","of","(","date",",","asset",")",".","Contains","an","entry","for","each","(","date",",","asset",")","pair","corresponding","to","a","`","True","`","value","in","`","mask","`",".","columns",":","Index","of","str","One","column","per","entry","in","`","data","`",".","If","mask","[","date",",","asset","]","is","True",",","then","result.loc","[","(","date",",","asset",")",",","colname","]","will","contain","the","value","of","data","[","colname","]","[","date",",","asset","]","."]
code: def _to_narrow(self, terms, data, mask, dates, assets):
      """
      Convert raw computed pipeline results into a DataFrame for public APIs.
  
      Parameters
      ----------
      terms : dict[str -> Term]
          Dict mapping column names to terms.
      data : dict[str -> ndarray[ndim=2]]
          Dict mapping column names to computed results for those names.
      mask : ndarray[bool, ndim=2]
          Mask array of values to keep.
      dates : ndarray[datetime64, ndim=1]
          Row index for arrays `data` and `mask`
      assets : ndarray[int64, ndim=2]
          Column index for arrays `data` and `mask`
  
      Returns
      -------
      results : pd.DataFrame
          The indices of `results` are as follows:
  
          index : two-tiered MultiIndex of (date, asset).
              Contains an entry for each (date, asset) pair corresponding to
              a `True` value in `mask`.
          columns : Index of str
              One column per entry in `data`.
  
      If mask[date, asset] is True, then result.loc[(date, asset), colname]
      will contain the value of data[colname][date, asset].
      """
      if not mask.any():
          # Manually handle the empty DataFrame case. This is a workaround
          # to pandas failing to tz_localize an empty dataframe with a
          # MultiIndex. It also saves us the work of applying a known-empty
          # mask to each array.
          #
          # Slicing `dates` here to preserve pandas metadata.
          empty_dates = dates[:0]
          empty_assets = array([], dtype=object)
          return DataFrame(
              data={
                  name: array([], dtype=arr.dtype)
                  for name, arr in iteritems(data)
              },
              index=MultiIndex.from_arrays([empty_dates, empty_assets]),
          )
  
      final_columns = {}
      for name in data:
          # Each term that computed an output has its postprocess method
          # called on the filtered result.
          #
          # As of Mon May 2 15:38:47 2016, we only use this to convert
          # LabelArrays into categoricals.
          final_columns[name] = terms[name].postprocess(
              data[name][mask]
          )
  
      resolved_assets = array(self._finder.retrieve_all(assets))
      index = _pipeline_output_index(dates, resolved_assets, mask)
  
      return DataFrame(data=final_columns, index=index)
  
imports: from abc import ABCMeta, abstractmethod
  from functools import partial
  from six import iteritems, with_metaclass, viewkeys
  from numpy import array, arange
  from pandas import DataFrame, MultiIndex
  from toolz import groupby
  from zipline.lib.adjusted_array import ensure_adjusted_array, ensure_ndarray
  from zipline.errors import NoFurtherDataError
  from zipline.utils.input_validation import expect_types
  from zipline.utils.numpy_utils import as_column, repeat_first_axis, repeat_last_axis
  from zipline.utils.pandas_utils import explode
  from zipline.utils.string_formatting import bulleted_list
  from .domain import Domain, GENERIC
  from .graph import maybe_specialize
  from .hooks import DelegatingHooks
  from .term import AssetExists, InputDates, LoadableTerm
  from zipline.utils.date_utils import compute_date_range_chunks
  from zipline.utils.pandas_utils import categorical_df_concat
label_desc: Use image node_id 8 for calling the SimplePipelineEngine obj's underlying member method code with example usage: obj._to_narrow(terms, data, mask, dates, assets) and returns: DataFrame, DataFrame