(self)
return func_lines
Generate code lines with definition of resulting index for DF set_column
Generate code lines with definition of resulting index for DF set_column
Generate code lines with definition of resulting index for DF set_column
def df_set_column_index_codelines(self):
    """Generate code lines with definition of resulting index for DF set_column"""
    index_param_expr = 'self._index' if not isinstance(self.index, EmptyIndexType) else 'None'
    func_lines = []
    if self.columns:
        func_lines += [
            f'  length = len(self._index)',
            f'  if length == 0:',
            f'    raise SDCLimitation("Could not set item for DataFrame with empty columns")',
            f'  elif length != len(value):',
            f'    raise ValueError("Length of values does not match length of index")',
        ]
    else:
        func_lines += ['  length = len(value)']
    func_lines += [f'  res_index = {index_param_expr}']

    return func_lines
def df_set_column_index_codelines ( self ) : index_param_expr = 'self._index' if not isinstance ( self . index , EmptyIndexType ) else 'None' func_lines = [ ] if self . columns : func_lines += [ f'  length = len(self._index)' , f'  if length == 0:' , f'    raise SDCLimitation("Could not set item for DataFrame with empty columns")' , f'  elif length != len(value):' , f'    raise ValueError("Length of values does not match length of index")' , ] else : func_lines += [ '  length = len(value)' ] func_lines += [ f'  res_index = {index_param_expr}' ] return func_lines