(self, idx)
return func_text, global_vars
Example of generated implementation:
        def _df_getitem_slice_iloc_impl(self, idx):
          data_0 = pandas.Series(self._dataframe._data[0][0])
          result_0 = data_0.iloc[idx]
          data_1 = pandas.Series(self._dataframe._data[0][1])
          result_1 = data_1.iloc[idx]
          data_2 = pandas.Series(self._dataframe._data[1][0])
          result_2 = data_2.iloc[idx]
          return pandas.DataFrame(data={"A": result_0, "B": result_1, "C": result_2}, index=self._dataframe.index[idx])
Example of generated implementation:
        def _df_getitem_slice_iloc_impl(self, idx):
          data_0 = pandas.Series(self._dataframe._data[0][0])
          result_0 = data_0.iloc[idx]
          data_1 = pandas.Series(self._dataframe._data[0][1])
          result_1 = data_1.iloc[idx]
          data_2 = pandas.Series(self._dataframe._data[1][0])
          result_2 = data_2.iloc[idx]
          return pandas.DataFrame(data={"A": result_0, "B": result_1, "C": result_2}, index=self._dataframe.index[idx])
Example of generated implementation : def _df_getitem_slice_iloc_impl ( self idx ) : data_0 = pandas . Series ( self . _dataframe . _data [ 0 ] [ 0 ] ) result_0 = data_0 . iloc [ idx ] data_1 = pandas . Series ( self . _dataframe . _data [ 0 ] [ 1 ] ) result_1 = data_1 . iloc [ idx ] data_2 = pandas . Series ( self . _dataframe . _data [ 1 ] [ 0 ] ) result_2 = data_2 . iloc [ idx ] return pandas . DataFrame ( data = { A : result_0 B : result_1 C : result_2 } index = self . _dataframe . index [ idx ] )
def df_getitem_slice_iloc_codegen(self, idx):
    """
    Example of generated implementation:
        def _df_getitem_slice_iloc_impl(self, idx):
          data_0 = pandas.Series(self._dataframe._data[0][0])
          result_0 = data_0.iloc[idx]
          data_1 = pandas.Series(self._dataframe._data[0][1])
          result_1 = data_1.iloc[idx]
          data_2 = pandas.Series(self._dataframe._data[1][0])
          result_2 = data_2.iloc[idx]
          return pandas.DataFrame(data={"A": result_0, "B": result_1, "C": result_2}, index=self._dataframe.index[idx])
    """
    func_lines = ['def _df_getitem_slice_iloc_impl(self, idx):']
    results = []
    for i, c in enumerate(self.columns):
        col_loc = self.column_loc[c]
        type_id, col_id = col_loc.type_id, col_loc.col_id
        result_c = f"result_{i}"
        func_lines += [f"  data_{i} = pandas.Series(self._dataframe._data[{type_id}][{col_id}])",
                       f"  {result_c} = data_{i}.iloc[idx]"]
        results.append((c, result_c))
    data = ', '.join(f'"{col}": {data}' for col, data in results)
    func_lines += [f"  return pandas.DataFrame(data={{{data}}}, index=self._dataframe.index[idx])"]

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

    return func_text, global_vars
def df_getitem_slice_iloc_codegen ( self , idx ) : func_lines = [ 'def _df_getitem_slice_iloc_impl(self, idx):' ] results = [ ] for i , c in enumerate ( self . columns ) : col_loc = self . column_loc [ c ] type_id , col_id = col_loc . type_id , col_loc . col_id result_c = f"result_{i}" func_lines += [ f"  data_{i} = pandas.Series(self._dataframe._data[{type_id}][{col_id}])" , f"  {result_c} = data_{i}.iloc[idx]" ] results . append ( ( c , result_c ) ) data = ', ' . join ( f'"{col}": {data}' for col , data in results ) func_lines += [ f"  return pandas.DataFrame(data={{{data}}}, index=self._dataframe.index[idx])" ] func_text = '\n' . join ( func_lines ) global_vars = { 'pandas' : pandas , 'numpy' : numpy } return func_text , global_vars