(self, idx)
return func_text, global_vars
Example of generated implementation with provided index:
        def _df_getitem_slice_idx_impl(self, idx):
          list_0 = self._data[0].copy()
          for i, item in enumerate(list_0):
            list_0[i] = item[idx]
          res_data = (list_0, )
          res_index = self._index[idx]
          return init_dataframe_internal(res_data, res_index, df_type)
Example of generated implementation with provided index:
        def _df_getitem_slice_idx_impl(self, idx):
          list_0 = self._data[0].copy()
          for i, item in enumerate(list_0):
            list_0[i] = item[idx]
          res_data = (list_0, )
          res_index = self._index[idx]
          return init_dataframe_internal(res_data, res_index, df_type)
Example of generated implementation with provided index : def _df_getitem_slice_idx_impl ( self idx ) : list_0 = self . _data [ 0 ] . copy () for i item in enumerate ( list_0 ) : list_0 [ i ] = item [ idx ] res_data = ( list_0 ) res_index = self . _index [ idx ] return init_dataframe_internal ( res_data res_index df_type )
def df_getitem_slice_idx_codegen(self, idx):
    """
    Example of generated implementation with provided index:
        def _df_getitem_slice_idx_impl(self, idx):
          list_0 = self._data[0].copy()
          for i, item in enumerate(list_0):
            list_0[i] = item[idx]
          res_data = (list_0, )
          res_index = self._index[idx]
          return init_dataframe_internal(res_data, res_index, df_type)
    """
    func_lines = ['def _df_getitem_slice_idx_impl(self, idx):']
    if self.columns:
        func_lines += df_getitem_slice_idx_main_codelines(self, idx)
    else:
        # raise KeyError if input DF is empty
        func_lines += df_getitem_key_error_codelines()
    func_text = '\n'.join(func_lines)

    # since we need to know result df type to call init_dataframe_internal
    # deduce the resulting df index type
    index_getitem_sig = cpu_target.typing_context.resolve_function_type(
        operator.getitem,
        (self.index, idx),
        {}
    )
    new_index_type = index_getitem_sig.return_type
    df_type = DataFrameType(self.data, new_index_type, self.columns, column_loc=self.column_loc)

    global_vars = {'pandas': pandas,
                   'numpy': numpy,
                   'df_type': df_type,
                   'init_dataframe_internal': init_dataframe_internal}

    return func_text, global_vars
def df_getitem_slice_idx_codegen ( self , idx ) : func_lines = [ 'def _df_getitem_slice_idx_impl(self, idx):' ] if self . columns : func_lines += df_getitem_slice_idx_main_codelines ( self , idx ) else : # raise KeyError if input DF is empty func_lines += df_getitem_key_error_codelines ( ) func_text = '\n' . join ( func_lines ) # since we need to know result df type to call init_dataframe_internal # deduce the resulting df index type index_getitem_sig = cpu_target . typing_context . resolve_function_type ( operator . getitem , ( self . index , idx ) , { } ) new_index_type = index_getitem_sig . return_type df_type = DataFrameType ( self . data , new_index_type , self . columns , column_loc = self . column_loc ) global_vars = { 'pandas' : pandas , 'numpy' : numpy , 'df_type' : df_type , 'init_dataframe_internal' : init_dataframe_internal } return func_text , global_vars