Series.to_string()
Pandas Series.to_string()
displays the string representation of the Series.
Syntax: Series.to_string (buf = None, na_rep = ’NaN’, float_format = None, header = True, index = True, length = False, dtype = False, name = False, max_rows = None)
Parameter:
buf: buffer to write to
na_rep: string representation of NAN to use, default ’NaN’
float_format: formatter function to apply to columns’ elements if they are floats default None
header : Add the Series header (index name)
index: Add index (row) labels, default True
length: Add the Series length
dtype: Add the Series dtype
name: Add the Series name if not None
max_rows: Maximum number of rows to show before truncat ing.Returns: Formatted string.
Example # 1: Using Series.to_string ()
a function to render the string representation of a given series of objects.
|
Output:
Now we will use Series.to_string ()
to render a string representation of this series object.
|
Output:
As we can see in the output, Series.to_string ()
has successfully rendered the string representation for the given object.
Example # 2: Use
|
Output:
Now we we will use Series.to_string ()
to render a string representation of this series object.
|
Output:
Like us we can see in the output that Series.to_string ()
has successfully rendered the string representation for the given object.