(self, literal_idx)
return func_lines
Generate main code lines for df.getitem with idx of tuple
Generate main code lines for df.getitem with idx of tuple
Generate main code lines for df . getitem with idx of tuple
def df_getitem_tuple_idx_main_codelines(self, literal_idx):
    """Generate main code lines for df.getitem with idx of tuple"""
    results = []
    func_lines = [f'  res_index = self.index']
    needed_cols = {col: i for i, col in enumerate(self.columns) if col in literal_idx}
    for col, i in needed_cols.items():
        col_loc = self.column_loc[col]
        type_id, col_id = col_loc.type_id, col_loc.col_id
        res_data = f'res_data_{i}'
        func_lines += [
            f'  data_{i} = self._data[{type_id}][{col_id}]',
            f'  {res_data} = pandas.Series(data_{i}, index=res_index, name="{col}")'
        ]
        results.append((col, res_data))

    data = ', '.join(f'"{col}": {data}' for col, data in results)
    func_lines += [f'  return pandas.DataFrame({{{data}}}, index=res_index)']

    return func_lines
def df_getitem_tuple_idx_main_codelines ( self , literal_idx ) : results = [ ] func_lines = [ f'  res_index = self.index' ] needed_cols = { col : i for i , col in enumerate ( self . columns ) if col in literal_idx } for col , i in needed_cols . items ( ) : col_loc = self . column_loc [ col ] type_id , col_id = col_loc . type_id , col_loc . col_id res_data = f'res_data_{i}' func_lines += [ f'  data_{i} = self._data[{type_id}][{col_id}]' , f'  {res_data} = pandas.Series(data_{i}, index=res_index, name="{col}")' ] results . append ( ( col , res_data ) ) data = ', ' . join ( f'"{col}": {data}' for col , data in results ) func_lines += [ f'  return pandas.DataFrame({{{data}}}, index=res_index)' ] return func_lines