def to_string(self, buf=None, na_rep='<STR_LIT>', float_format=None, header=True,<EOL>index=True, length=False, dtype=False, name=False,<EOL>max_rows=None):
formatter = fmt.SeriesFormatter(self, name=name, length=length,<EOL>header=header, index=index,<EOL>dtype=dtype, na_rep=na_rep,<EOL>float_format=float_format,<EOL>max_rows=max_rows)<EOL>result = formatter.to_string()<EOL>if not isinstance(result, str):<EOL><INDENT>raise AssertionError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(result.__class__.__name__))<EOL><DEDENT>if buf is None:<EOL><INDENT>return result<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>buf.write(result)<EOL><DEDENT>except AttributeError:<EOL><INDENT>with open(buf, '<STR_LIT:w>') as f:<EOL><INDENT>f.write(result)<EOL><DEDENT><DEDENT><DEDENT>
Render a string representation of the Series.

Parameters
----------
buf : StringIO-like, optional
    Buffer to write to.
na_rep : str, optional
    String representation of NaN to use, default 'NaN'.
float_format : one-parameter function, optional
    Formatter function to apply to columns' elements if they are
    floats, default None.
header : bool, default True
    Add the Series header (index name).
index : bool, optional
    Add index (row) labels, default True.
length : bool, default False
    Add the Series length.
dtype : bool, default False
    Add the Series dtype.
name : bool, default False
    Add the Series name if not None.
max_rows : int, optional
    Maximum number of rows to show before truncating. If None, show
    all.

Returns
-------
str or None
    String representation of Series if ``buf=None``, otherwise None.