pandas.Series.to_string
pandas 3.1.1 · Series and accessors · method
Return a human-readable textual representation or write it to the supplied buffer.
Call syntax
Series.to_string(…) Full signature
Series.to_string(
buf=None,
*,
na_rep='NaN',
float_format=None,
header=True,
index=True,
length=False,
dtype=False,
name=False,
max_rows=None,
min_rows=None,
)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
buf |
Optional Positional or keyword Default None |
StringIO-like Supply a destination file-like buffer, or use the default to return or print the output as documented. |
na_rep |
Optional Keyword only Default 'NaN' |
str Choose the text used to display missing values. |
float_format |
Optional Keyword only Default None |
one-parameter function Provide a format string or callable to control numeric display. |
header |
Optional Keyword only Default True |
bool Define which row or rows provide column names, or control whether to write them. |
index |
Optional Keyword only Default True |
bool Supply row labels or control how existing row labels are used. |
length |
Optional Keyword only Default False |
bool |
dtype |
Optional Keyword only Default False |
bool Choose the data type for the input conversion or result. |
name |
Optional Keyword only Default False |
bool Set a name or identify the named object used by the operation. |
max_rows |
Optional Keyword only Default None |
int |
min_rows |
Optional Keyword only Default None |
int |
Returns
str or None