cudf.Series.to_string#
- Series.to_string(
- buf=None,
- *,
- na_rep: str = 'NaN',
- float_format=None,
- header: bool = True,
- index: bool = True,
- length: bool = False,
- dtype: bool = False,
- name: bool = False,
- max_rows: int | None = None,
- min_rows: int | None = None,
Render a Series to a console-friendly string output.
cuDF uses pandas internals for string formatting, so this mirrors
pandas.Series.to_string()and accepts the same arguments. Unlikerepr, the output is not truncated by thedisplay.max_rowsoption unlessmax_rowsis passed explicitly, and thedtype/name/lengthfooter is omitted unless requested.cuDF supports null/None as a value in any column type, which is transparently supported during this output process.
- Parameters:
- bufwritable buffer, optional
File path or buffer to write to. If
None(default), the output is returned as a string.- na_repstr, default “NaN”
String representation of
NaN/null values.- float_formatcallable, optional
One-parameter formatter function applied to floating point values.
- headerbool, default True
Whether to print the Series header (the index name).
- indexbool, default True
Whether to print index (row) labels.
- lengthbool, default False
Whether to append the Series length to the output.
- dtypebool, default False
Whether to append the Series dtype to the output.
- namebool, default False
Whether to append the Series name to the output.
- max_rowsint, optional
Maximum number of rows to show before truncating. If
None, all rows are shown.- min_rowsint, optional
Number of rows to show in a truncated output (when the number of rows exceeds
max_rows).
- Returns:
- str or None
The string representation of the Series when
bufisNone; otherwise the result is written tobufandNoneis returned.
Examples
>>> import cudf >>> series = cudf.Series([1, 2, 3, 4]) >>> series.to_string() '0 1\n1 2\n2 3\n3 4'