(self, idx)
return func_text, global_vars
Example of generated implementation:
        def _df_getitem_int_iloc_impl(self, idx):
          if -1 < idx < len(self._dataframe.index):
            data_0 = pandas.Series(self._dataframe._data[0][0])
            result_0 = data_0.iat[idx]
            data_1 = pandas.Series(self._dataframe._data[0][1])
            result_1 = data_1.iat[idx]
            data_2 = pandas.Series(self._dataframe._data[1][0])
            result_2 = data_2.iat[idx]
            return pandas.Series(data=[result_0, result_1, result_2], index=['A', 'B', 'C'], name=str(idx))
          raise IndexingError('Index is out of bounds for axis')
Example of generated implementation:
        def _df_getitem_int_iloc_impl(self, idx):
          if -1 < idx < len(self._dataframe.index):
            data_0 = pandas.Series(self._dataframe._data[0][0])
            result_0 = data_0.iat[idx]
            data_1 = pandas.Series(self._dataframe._data[0][1])
            result_1 = data_1.iat[idx]
            data_2 = pandas.Series(self._dataframe._data[1][0])
            result_2 = data_2.iat[idx]
            return pandas.Series(data=[result_0, result_1, result_2], index=['A', 'B', 'C'], name=str(idx))
          raise IndexingError('Index is out of bounds for axis')
Example of generated implementation : def _df_getitem_int_iloc_impl ( self idx ) : if - 1 < idx < len ( self . _dataframe . index ) : data_0 = pandas . Series ( self . _dataframe . _data [ 0 ] [ 0 ] ) result_0 = data_0 . iat [ idx ] data_1 = pandas . Series ( self . _dataframe . _data [ 0 ] [ 1 ] ) result_1 = data_1 . iat [ idx ] data_2 = pandas . Series ( self . _dataframe . _data [ 1 ] [ 0 ] ) result_2 = data_2 . iat [ idx ] return pandas . Series ( data = [ result_0 result_1 result_2 ] index = [ A B C ] name = str ( idx )) raise IndexingError ( Index is out of bounds for axis )
def df_getitem_int_iloc_codegen(self, idx):
    """
    Example of generated implementation:
        def _df_getitem_int_iloc_impl(self, idx):
          if -1 < idx < len(self._dataframe.index):
            data_0 = pandas.Series(self._dataframe._data[0][0])
            result_0 = data_0.iat[idx]
            data_1 = pandas.Series(self._dataframe._data[0][1])
            result_1 = data_1.iat[idx]
            data_2 = pandas.Series(self._dataframe._data[1][0])
            result_2 = data_2.iat[idx]
            return pandas.Series(data=[result_0, result_1, result_2], index=['A', 'B', 'C'], name=str(idx))
          raise IndexingError('Index is out of bounds for axis')
    """
    func_lines = ['def _df_getitem_int_iloc_impl(self, idx):',
                  '  if -1 < idx < len(self._dataframe.index):']
    results = []
    index = []
    name = 'self._dataframe._index[idx]'
    if isinstance(self.index, PositionalIndexType):
        name = 'idx'
    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}.iat[idx]"]
        results.append(result_c)
        index.append(c)
    data = ', '.join(col for col in results)
    func_lines += [f"    return pandas.Series(data=[{data}], index={index}, name=str({name}))",
                   f"  raise IndexingError('Index is out of bounds for axis')"]

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

    return func_text, global_vars
def df_getitem_int_iloc_codegen ( self , idx ) : func_lines = [ 'def _df_getitem_int_iloc_impl(self, idx):' , '  if -1 < idx < len(self._dataframe.index):' ] results = [ ] index = [ ] name = 'self._dataframe._index[idx]' if isinstance ( self . index , PositionalIndexType ) : name = 'idx' 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}.iat[idx]" ] results . append ( result_c ) index . append ( c ) data = ', ' . join ( col for col in results ) func_lines += [ f"    return pandas.Series(data=[{data}], index={index}, name=str({name}))" , f"  raise IndexingError('Index is out of bounds for axis')" ] func_text = '\n' . join ( func_lines ) global_vars = { 'pandas' : pandas , 'numpy' : numpy , 'IndexingError' : IndexingError } return func_text , global_vars