Config#
Config options#
|
Activate |
|
Use ASCII characters to display table outlines (set False to revert to UTF8). |
|
Control how floating point values are displayed. |
Set the number of characters used to display string values. |
|
Overwrite chunk size used in |
|
|
Set table cell alignment. |
Set the number of columns that are visible when displaying tables. |
|
|
Moves the data type inline with the column name (to the right, in parentheses). |
|
Print the dataframe shape below the dataframe when displaying tables. |
|
Set table formatting style. |
|
Hide table column data types (i64, f64, str etc.). |
|
Hide table column names. |
|
Hide the shape information of the dataframe when displaying tables. |
|
Hide the '---' separator between the column names and column types. |
Set the max number of rows used to draw the table (both Dataframe and Series). |
|
|
Set the number of characters used to draw the table. |
|
Enable additional verbose/debug logging. |
Config load, save, and current state#
|
Load and set previously saved (or shared) Config options from json/file. |
|
Save the current set of Config options as a json string or file. |
|
Show the current state of all Config variables as a dict. |
Reset all polars Config settings to their default state. |
Use as a context manager#
Note that Config
supports setting context-scoped options. These options
are valid only during scope lifetime, and are reset to their initial values
(whatever they were before entering the new context) on scope exit.
You can take advantage of this by initialising a``Config`` instance and then explicitly calling one or more of the available “set_” methods on it…
with pl.Config() as cfg:
cfg.set_verbose(True)
do_various_things()
# on scope exit any modified settings are restored to their previous state
…or, often cleaner, by setting the options in the Config
init directly
(optionally omitting the “set_” prefix for brevity):
with pl.Config(verbose=True):
do_various_things()
Use as a function decorator#
In the same vein, you can also use Config
as a function decorator to
temporarily set options for the duration of the function call:
@pl.Config(set_ascii_tables=True)
def write_ascii_frame_to_stdout(df: pl.DataFrame) -> None:
sys.stdout.write(str(df))
“””