parameters: (self, cursor)
return_statement: return data
docstring: Format each record for consumption by a dataframe
  
          returns a dictionary with the key being the name of the sheet, and values
          a list of dicts to feed into a DataFrame
docstring_summary: Format each record for consumption by a dataframe
docstring_tokens: Format each record for consumption by a dataframe
function: def _format_for_dataframe(self, cursor):
          """
          Format each record for consumption by a dataframe
  
          returns a dictionary with the key being the name of the sheet, and values
          a list of dicts to feed into a DataFrame
          """
          data = dict((section_name, []) for section_name in self.sections.keys())
  
          main_section = self.sections[self.survey_name]
          main_sections_columns = main_section["columns"]
  
          for record in cursor:
              # from record, we'll end up with multiple records, one for each
              # section we have
  
              # add records for the default section
              self._add_data_for_section(data[self.survey_name],
                  record, main_sections_columns, self.survey_name)
              parent_index = main_section[self.CURRENT_INDEX_META]
  
              for sheet_name, section in self.sections.iteritems():
                  # skip default section i.e survey name
                  if sheet_name != self.survey_name:
                      xpath = section["xpath"]
                      columns = section["columns"]
                      # TODO: handle nested repeats -ignoring nested repeats for
                      # now which will not be in the top level record, perhaps
                      # nest sections as well so we can recurs in and get them
                      if record.has_key(xpath):
                          repeat_records = record[xpath]
                          num_repeat_records = len(repeat_records)
                          for repeat_record in repeat_records:
                              self._add_data_for_section(data[sheet_name],
                                  repeat_record, columns, sheet_name,
                                  parent_index, self.survey_name)
  
          return data
function_tokens: def _format_for_dataframe ( self , cursor ) : data = dict ( ( section_name , [ ] ) for section_name in self . sections . keys ( ) ) main_section = self . sections [ self . survey_name ] main_sections_columns = main_section [ "columns" ] for record in cursor : # from record, we'll end up with multiple records, one for each # section we have # add records for the default section self . _add_data_for_section ( data [ self . survey_name ] , record , main_sections_columns , self . survey_name ) parent_index = main_section [ self . CURRENT_INDEX_META ] for sheet_name , section in self . sections . iteritems ( ) : # skip default section i.e survey name if sheet_name != self . survey_name : xpath = section [ "xpath" ] columns = section [ "columns" ] # TODO: handle nested repeats -ignoring nested repeats for # now which will not be in the top level record, perhaps # nest sections as well so we can recurs in and get them if record . has_key ( xpath ) : repeat_records = record [ xpath ] num_repeat_records = len ( repeat_records ) for repeat_record in repeat_records : self . _add_data_for_section ( data [ sheet_name ] , repeat_record , columns , sheet_name , parent_index , self . survey_name ) return data