# dask.dataframe.DataFrame.to_string

#### DataFrame.to_string(max_rows=5)

Render a DataFrame to a console-friendly tabular output.

This docstring was copied from pandas.DataFrame.to_string.

Some inconsistencies with the Dask version may exist.

This method converts the DataFrame to a string representation suitable
for printing or writing to a file.

* **Parameters:**
  **buf**
  : Buffer to write to. If None, the output is returned as a string.

  **columns**
  : The subset of columns to write. Writes all columns by default.

  **col_space**
  : The minimum width of each column. If a list of ints is given every
    integers corresponds with one column. If a dict is given, the key
    references the column, while the value defines the space to use.

  **header**
  : Write out the column names. If a list of columns is given, it is
    assumed to be aliases for the column names.

  **index**
  : Whether to print index (row) labels.

  **na_rep**
  : String representation of `NaN` to use.

  **formatters**
  : Formatter functions to apply to columns’ elements by position or
    name.
    The result of each function must be a unicode string.
    List/tuple must be of length equal to the number of columns.

  **float_format**
  : Formatter function to apply to columns’ elements if they are
    floats. This function must return a unicode string and will be
    applied only to the non-`NaN` elements, with `NaN` being
    handled by `na_rep`.

  **sparsify**
  : Set to False for a DataFrame with a hierarchical index to print
    every multiindex key at each row.

  **index_names**
  : Prints the names of the indexes.

  **justify**
  : How to justify the column labels. If None uses the option from
    the print configuration (controlled by set_option), ‘right’ out
    of the box. Valid values are
    * left
    * right
    * center
    * justify
    * justify-all
    * start
    * end
    * inherit
    * match-parent
    * initial
    * unset.

  **max_rows**
  : Maximum number of rows to display in the console.

  **max_cols**
  : Maximum number of columns to display in the console.

  **show_dimensions**
  : Display DataFrame dimensions (number of rows by number of columns).

  **decimal**
  : Character recognized as decimal separator, e.g. ‘,’ in Europe.

  **line_width**
  : Width to wrap a line in characters.

  **min_rows**
  : The number of rows to display in the console in a truncated repr
    (when number of rows is above max_rows).

  **max_colwidth**
  : Max width to truncate each column in characters. By default, no limit.

  **encoding**
  : Set character encoding.
* **Returns:**
  str or None
  : If buf is None, returns the result as a string. Otherwise returns
    None.

#### SEE ALSO
[`to_html`](dask.dataframe.DataFrame.to_html.html.md#dask.dataframe.DataFrame.to_html)
: Convert DataFrame to HTML.

### Examples

```pycon
>>> d = {"col1": [1, 2, 3], "col2": [4, 5, 6]}
>>> df = pd.DataFrame(d)
>>> print(df.to_string())
   col1  col2
0     1     4
1     2     5
2     3     6
```

<!-- !! processed by numpydoc !! -->
