Display
Utilities for displaying text, tables, and plots in Pandas Checks in both terminal and IPython/Jupyter environments.
_display_check(data, name=None)
Renders the result of a Pandas Checks method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Any
|
The data to display. |
required |
name
|
Union[str, None]
|
The optional name of the check. |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
_display_line(line, lead_in=None, colors={})
Displays a line of text with optional formatting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line
|
str
|
The text to display. |
required |
lead_in
|
Union[str, None]
|
The optional text to display before the main text. |
None
|
colors
|
Dict
|
An optional dictionary containing color options for the text and lead-in text. See syntax in docstring for _render_text(). |
{}
|
Returns:
Type | Description |
---|---|
None
|
None |
_display_plot()
Renders the active Pandas Checks matplotlib plot object in an IPython/Jupyter environment with an optional indent.
Returns:
Type | Description |
---|---|
None
|
None |
Note
It assumes the plot has already been drawn by another function, such as with .plot() or .hist().
_display_plot_title(line, lead_in=None, colors={})
Displays a plot title with optional formatting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line
|
str
|
The title text to display. |
required |
lead_in
|
Union[str, None]
|
Optional text to display before the title. |
None
|
colors
|
Dict
|
An optional dictionary containing color settings for the text and lead-in text. See details in docstring for _render_text(). |
{}
|
Returns:
Type | Description |
---|---|
None
|
None |
_display_table(table)
Renders a Pandas DataFrame or Series in an IPython/Jupyter environment with an optional indent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table
|
Union[DataFrame, Series]
|
The DataFrame or Series to display. |
required |
Returns:
Type | Description |
---|---|
None
|
None |
_display_table_title(line, lead_in=None, colors={})
Displays a table title with optional formatting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line
|
str
|
The title text to display. |
required |
lead_in
|
Union[str, None]
|
Optional text to display before the title. |
None
|
colors
|
Dict
|
An optiona dictionary containing color options for the text and lead-in text. See details in docstring for _render_text() |
{}
|
Returns:
Type | Description |
---|---|
None
|
None |
_filter_emojis(text)
Removes emojis from text if user has globally forbidden them.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
The text to filter emojis from. |
required |
Returns:
Type | Description |
---|---|
str
|
The text with emojis removed if the user's global settings do not allow emojis. Else, the original text. |
_format_background_color(color)
Applies a background color to text used being displayed in the terminal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
color
|
str
|
The background color to format. See syntax in docstring for _render_text(). |
required |
Returns:
Type | Description |
---|---|
str
|
The formatted background color. |
_lead_in(lead_in, foreground, background)
Formats a lead-in text with colors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lead_in
|
Union[str, None]
|
The lead-in text to format. |
required |
foreground
|
str
|
The foreground color for the lead-in text. See syntax in docstring for _render_text(). |
required |
background
|
str
|
The background color for the lead-in text. See syntax in docstring for _render_text(). |
required |
Returns:
Type | Description |
---|---|
str
|
The formatted lead-in text. |
_print_table_terminal(table)
Prints a Pandas table in a terminal with an optional indent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table
|
Union[DataFrame, Series]
|
A DataFrame or Series. |
required |
Returns:
Type | Description |
---|---|
None
|
None |
_render_html_with_indent(object_as_html)
Renders HTML with an optional indent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
object_as_html
|
str
|
The HTML to render. |
required |
Returns:
Type | Description |
---|---|
None
|
None |
_render_text(text, tag, lead_in=None, colors={})
Renders text with optional formatting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
The text to render. |
required |
tag
|
str
|
The HTML tag to use for rendering. |
required |
lead_in
|
Union[str, None]
|
Optional text to display before the main text. |
None
|
colors
|
Dict
|
Optional colors for the text and lead-in text.
Keys include:
- text_color: The foreground color of the main text.
- text_background_color: The background or highlight color of the main text.
- lead_in_text_color: The foreground color of lead-in text.
- lead_in_background_color: The background color of lead-in text.
Color values are phrased such as "blue" or "white". They are passed to either HTML
for Jupyter/IPython outputs and to |
{}
|
Returns:
Type | Description |
---|---|
None
|
None |
_warning(message, lead_in='🐼🩺 Pandas Checks warning', clean_type=False)
Displays a warning message.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message
|
str
|
The warning message to display. |
required |
lead_in
|
str
|
Optional lead-in text to display before the warning message. |
'🐼🩺 Pandas Checks warning'
|
clean_type
|
bool
|
Optional flag to remove the class type from the message, when running .check.dtype(). |
False
|
Returns:
Type | Description |
---|---|
None
|
None |