polars.DataFrame.glimpse#
- DataFrame.glimpse(*, return_as_string: Literal[False]) None [source]#
- DataFrame.glimpse(*, return_as_string: Literal[True]) str
Return a dense preview of the dataframe.
The formatting is done one line per column, so wide dataframes show nicely. Each line will show the column name, the data type and the first few values.
- Parameters:
- return_as_string
If True, return as string rather than printing to stdout.
Examples
>>> from datetime import date >>> df = pl.DataFrame( ... { ... "a": [1.0, 2.8, 3.0], ... "b": [4, 5, None], ... "c": [True, False, True], ... "d": [None, "b", "c"], ... "e": ["usd", "eur", None], ... "f": [date(2020, 1, 1), date(2021, 1, 2), date(2022, 1, 1)], ... } ... ) >>> df.glimpse() Rows: 3 Columns: 6 $ a <f64> 1.0, 2.8, 3.0 $ b <i64> 4, 5, None $ c <bool> True, False, True $ d <str> None, b, c $ e <str> usd, eur, None $ f <date> 2020-01-01, 2021-01-02, 2022-01-01