original_docstring: 
          Generate a new Dataset from the row indices for DataFrames.
  
          Parameters
          ----------
          row_indices_to_keep:
              This is a dict where key is resource ID and value is a sequence of row indices to keep.
              If a resource ID is missing, the whole related resource is kept.
  
          Returns
          -------
          Returns a new Dataset.
          
docstring: Generate a new Dataset from the row indices for DataFrames.
  Parameters
  
  This is a dict where key is resource ID and value is a sequence of row indices to keep.
  If a resource ID is missing, the whole related resource is kept.
  
  Returns
  
  Returns a new Dataset.
docstring_tokens: Generate a new Dataset from the row indices for DataFrames . Parameters This is a dict where key is resource ID and value is a sequence of row indices to keep . If a resource ID is missing the whole related resource is kept . Returns Returns a new Dataset .
code: def select_rows(self: D, row_indices_to_keep: typing.Mapping[str, typing.Sequence[int]]) -> D:
          """
          Generate a new Dataset from the row indices for DataFrames.
  
          Parameters
          ----------
          row_indices_to_keep:
              This is a dict where key is resource ID and value is a sequence of row indices to keep.
              If a resource ID is missing, the whole related resource is kept.
  
          Returns
          -------
          Returns a new Dataset.
          """
  
          resources = {}
          metadata = self.metadata
  
          for resource_id, resource in self.items():
              # We keep any resource which is missing from "row_indices_to_keep".
              if resource_id not in row_indices_to_keep:
                  resources[resource_id] = resource
              else:
                  if not isinstance(resource, container_pandas.DataFrame):
                      raise exceptions.InvalidArgumentTypeError("Only DataFrame resources can have rows selected, not '{type}'.".format(type=type(resource)))
  
                  row_indices = sorted(row_indices_to_keep[resource_id])
                  resources[resource_id] = self[resource_id].iloc[row_indices, :].reset_index(drop=True)
  
                  # TODO: Expose this as a general metadata method.
                  #       In that case this has to be done recursively over all nested ALL_ELEMENTS.
                  #       Here we are operating at resource level so we have to iterate only over first
                  #       ALL_ELEMENTS and resource's element itself.
  
                  # Change the metadata. Update the number of rows in the split.
                  # This makes a copy so that we can modify metadata in-place.
                  metadata = metadata.update(
                      (resource_id,),
                      {
                          'dimension': {
                              'length': len(row_indices),
                          },
                      },
                  )
  
                  # Remove all rows not in this split and reorder those which are.
                  for element_metadata_entry in [
                      metadata._current_metadata.all_elements,
                      metadata._current_metadata.elements[resource_id],
                  ]:
                      if element_metadata_entry is None:
                          continue
  
                      elements = element_metadata_entry.elements
                      new_elements_evolver = utils.EMPTY_PMAP.evolver()
                      for i, row_index in enumerate(row_indices):
                          if row_index in elements:
                              new_elements_evolver.set(i, elements[row_index])
                      element_metadata_entry.elements = new_elements_evolver.persistent()
                      element_metadata_entry.is_elements_empty = not element_metadata_entry.elements
                      element_metadata_entry.update_is_empty()
  
          return type(self)(resources, metadata)
code_tokens: def select_rows ( self : D , row_indices_to_keep : typing . Mapping [ str , typing . Sequence [ int ] ] ) -> D : resources = { } metadata = self . metadata for resource_id , resource in self . items ( ) : if resource_id not in row_indices_to_keep : resources [ resource_id ] = resource else : if not isinstance ( resource , container_pandas . DataFrame ) : raise exceptions . InvalidArgumentTypeError ( "Only DataFrame resources can have rows selected, not '{type}'." . format ( type = type ( resource ) ) ) row_indices = sorted ( row_indices_to_keep [ resource_id ] ) resources [ resource_id ] = self [ resource_id ] . iloc [ row_indices , : ] . reset_index ( drop = True ) metadata = metadata . update ( ( resource_id , ) , { 'dimension' : { 'length' : len ( row_indices ) , } , } , ) for element_metadata_entry in [ metadata . _current_metadata . all_elements , metadata . _current_metadata . elements [ resource_id ] , ] : if element_metadata_entry is None : continue elements = element_metadata_entry . elements new_elements_evolver = utils . EMPTY_PMAP . evolver ( ) for i , row_index in enumerate ( row_indices ) : if row_index in elements : new_elements_evolver . set ( i , elements [ row_index ] ) element_metadata_entry . elements = new_elements_evolver . persistent ( ) element_metadata_entry . is_elements_empty = not element_metadata_entry . elements element_metadata_entry . update_is_empty ( ) return type ( self ) ( resources , metadata )
short_docstring: Generate a new Dataset from the row indices for DataFrames.
short_docstring_tokens: Generate a new Dataset from the row indices for DataFrames .
comment: """
          Generate a new Dataset from the row indices for DataFrames.
  
          Parameters
          ----------
          row_indices_to_keep:
              This is a dict where key is resource ID and value is a sequence of row indices to keep.
              If a resource ID is missing, the whole related resource is kept.
  
          Returns
          -------
          Returns a new Dataset.
          """$SEP$# We keep any resource which is missing from "row_indices_to_keep".$SEP$# TODO: Expose this as a general metadata method.$SEP$#       In that case this has to be done recursively over all nested ALL_ELEMENTS.$SEP$#       Here we are operating at resource level so we have to iterate only over first$SEP$#       ALL_ELEMENTS and resource's element itself.$SEP$# Change the metadata. Update the number of rows in the split.$SEP$# This makes a copy so that we can modify metadata in-place.$SEP$# Remove all rows not in this split and reorder those which are.