(self, idx)
return func_text, global_vars
Example of generated implementation with provided index:
        def _df_getitem_tuple_idx_impl(self, idx):
          res_index = self.index
          data_0 = self._data[0][0]
          res_data_0 = pandas.Series(data_0, index=res_index, name="A")
          data_2 = self._data[0][2]
          res_data_2 = pandas.Series(data_2, index=res_index, name="C")
          return pandas.DataFrame({"A": res_data_0, "C": res_data_2}, index=res_index)
Example of generated implementation with provided index:
        def _df_getitem_tuple_idx_impl(self, idx):
          res_index = self.index
          data_0 = self._data[0][0]
          res_data_0 = pandas.Series(data_0, index=res_index, name="A")
          data_2 = self._data[0][2]
          res_data_2 = pandas.Series(data_2, index=res_index, name="C")
          return pandas.DataFrame({"A": res_data_0, "C": res_data_2}, index=res_index)
Example of generated implementation with provided index : def _df_getitem_tuple_idx_impl ( self idx ) : res_index = self . index data_0 = self . _data [ 0 ] [ 0 ] res_data_0 = pandas . Series ( data_0 index = res_index name = A ) data_2 = self . _data [ 0 ] [ 2 ] res_data_2 = pandas . Series ( data_2 index = res_index name = C ) return pandas . DataFrame ( { A : res_data_0 C : res_data_2 } index = res_index )
def df_getitem_tuple_idx_codegen(self, idx):
    """
    Example of generated implementation with provided index:
        def _df_getitem_tuple_idx_impl(self, idx):
          res_index = self.index
          data_0 = self._data[0][0]
          res_data_0 = pandas.Series(data_0, index=res_index, name="A")
          data_2 = self._data[0][2]
          res_data_2 = pandas.Series(data_2, index=res_index, name="C")
          return pandas.DataFrame({"A": res_data_0, "C": res_data_2}, index=res_index)
    """
    func_lines = ['def _df_getitem_tuple_idx_impl(self, idx):']
    literal_idx = {col.literal_value for col in idx}
    key_error = any(i not in self.columns for i in literal_idx)

    if self.columns and not key_error:
        func_lines += df_getitem_tuple_idx_main_codelines(self, literal_idx)
    else:
        # raise KeyError if input DF is empty or idx is invalid
        func_lines += df_getitem_key_error_codelines()

    func_text = '\n'.join(func_lines)
    global_vars = {'pandas': pandas, 'numpy': numpy}

    return func_text, global_vars
def df_getitem_tuple_idx_codegen ( self , idx ) : func_lines = [ 'def _df_getitem_tuple_idx_impl(self, idx):' ] literal_idx = { col . literal_value for col in idx } key_error = any ( i not in self . columns for i in literal_idx ) if self . columns and not key_error : func_lines += df_getitem_tuple_idx_main_codelines ( self , literal_idx ) else : # raise KeyError if input DF is empty or idx is invalid func_lines += df_getitem_key_error_codelines ( ) func_text = '\n' . join ( func_lines ) global_vars = { 'pandas' : pandas , 'numpy' : numpy } return func_text , global_vars