def set_format(self, column_or_columns, formatter):
if inspect.isclass(formatter):<EOL><INDENT>formatter = formatter()<EOL><DEDENT>if callable(formatter) and not hasattr(formatter, '<STR_LIT>'):<EOL><INDENT>formatter = _formats.FunctionFormatter(formatter)<EOL><DEDENT>if not hasattr(formatter, '<STR_LIT>'):<EOL><INDENT>raise Exception('<STR_LIT>' + str(formatter))<EOL><DEDENT>for label in self._as_labels(column_or_columns):<EOL><INDENT>if formatter.converts_values:<EOL><INDENT>self[label] = formatter.convert_column(self[label])<EOL><DEDENT>self._formats[label] = formatter<EOL><DEDENT>return self<EOL>
Set the format of a column.