riptable.Utils.display_options
Display options for formatting and displaying numeric values, datasets, and multisets.
Classes
Provides display options for: |
- class riptable.Utils.display_options.DisplayOptions
Bases:
object
- Provides display options for:
console screen for customizing width, height, and character buffers
row, columns, and styles when displaying datasets and multisets
formatting headers, footers, and general string widths
formatting numeric types using scientific notation or specifying precision
other miscellaneous display options such as prefixing group by column names
- ROW_ALL
Toggle display of all rows for Dataset, Multiset, and Struct objects (default False).
- Type:
- COL_ALL
Toggle display of all columns for Dataset, Multiset, and Struct objects (default False).
- Type:
- COL_MIN
Minimum columns to display for Dataset, Multiset, and Struct objects (default 1).
- Type:
- COL_MAX
Maximum columns to display for Dataset, Multiset, and Struct objects (default 50).
- Type:
- COL_T
Number of transposed rows to display, which appear as columns for Dataset, Multiset, and Struct objects (default 8).
- Type:
- HEAD_ROWS
Number of rows to display when calling head on a Dataset, Multiset, or Struct object (default 15).
- Type:
- TAIL_ROWS
Number of rows to display when calling tail on a Dataset, Multiset, or Struct object (default 15).
- Type:
- MAX_ROWS
Maximum number of rows to display for Dataset, Multiset, and Struct objects (default 30).
- Type:
- NO_STYLES
Toggle for colors in IPython console (default False). Note, may be difficult to see with light background.
- Type:
- COLOR_MODE
Color mode for display (default None).
- Type:
DisplayColorMode or None, optional
- CUSTOM_COMPLETION = bool
Toggle on for attribute completion results that show in alphanumeric key, attribute, then method ordering for
Dataset
,Multiset
,Struct
(default False).This will override the default IPython
Completer._complete
to a custom variant that allows custom completer dispatching using theIPython.utils.generics.complete_object
hook while preserving the custom ordering.Caution, below are the side effects when toggling this on: - IPython
use_jedi
is set to False since this approach is currently incompatible with Jedi completion because the code is actually evaluated on TAB. - IPythonCompleter._complete
is monkey patched to change use the custom completion that is backwards compatible withCompleter._complete
, but allows preserving the order. - As of 20191218, ifCUSTOM_COMPLETION
is toggled on it results in a one-time registration of custom attribute completion per IPython session as opposed to supporting deregistration.
- MAX_HEADER_WIDTH
Maximum number of characters for header strings in a Dataset, Multiset, or Struct object (default 15).
- Type:
- MAX_FOOTER_WIDTH
Maximum number of characters for footer strings in Dataset, Multiset, or Struct object (default 15).
- Type:
- PRECISION
Number of digits to display to the right of the decimal (default 2).
- E_PRECISION
Number of digits to display to the right of the decimal in scientific notation (default 3).
- E_THRESHOLD
Power of 10 at which the float flips to scientific notation 10**+/- (default 6).
- P_THRESHOLD
Precision threshold for area in between - so small values don’t display as zero (default None).
- Type:
int or None, optional
- NUMBER_SEPARATOR_CHAR
Character for separating
,
,, or
_
(default DisplayNumberSeparator.Comma).- Type:
DisplayNumberSeparator
- save_config()
- load_config()
- reset_config()
- e_min()
- e_max()
- p_threshold()
- no_colors()
See also
DisplayTable
builds result tables with display options.
DisplayColorMode
enumerates supported color modes.
get_terminal_size
calculates console height and width.
Examples
CONSOLE_X_HTML
sets the number of characters for buffer width on the HTML display. Truncated characters are replaced by ellipsis.>>> from riptable.Utils.display_options import DisplayOptions >>> ds = rt.Dataset({'A':[0,6,9], 'B' : [1.2,3.1,9.6], 'C': [-1.6,2.7,4.6], 'D' : [2.4,6.2,19.2]}) >>> ds # A B C D - - ---- ----- ----- 0 0 1.20 -1.60 2.40 1 6 3.10 2.70 6.20 2 9 9.60 4.60 19.20 >>> DisplayOptions.CONSOLE_X_HTML = 25 >>> ds # A B ... D 0 0 1.20 ... 2.40 1 6 3.10 ... 6.20 2 9 9.60 ... 19.20
- COLOR_MODE
- COL_ALL = False
- COL_MAX = 50
- COL_MIN = 1
- COL_T = 8
- CONSOLE_X = 150
- CONSOLE_X_BUFFER = 30
- CONSOLE_X_HTML = 340
- CONSOLE_Y = 25
- E_MAX
- E_MIN
- E_PRECISION = 3
- E_THRESHOLD = 6
- GB_PREFIX = '*'
- HEAD_ROWS = 15
- HTML_DISPLAY = True
- MAX_FOOTER_WIDTH = 15
- MAX_HEADER_WIDTH = 15
- MAX_ROWS = 30
- MAX_STRING_WIDTH = 15
- NO_STYLES = False
- NUMBER_SEPARATOR = False
- NUMBER_SEPARATOR_CHAR
- PRECISION = 2
- P_THRESHOLD
- ROW_ALL = False
- TAIL_ROWS = 15
- X_PADDING = 4
- Y_PADDING = 3
- _AUTO_SAVE = False
- _BAR_GRAPH = False
- _BOUNDS
- _CONFIG_LOADED = False
- _HEAT_MAP = False
- _PAINT_MAX = False
- _PAINT_MIN = False
- _PAINT_SIGNS = False
- _PAINT_ZEROS = False
- _RESET_OPTIONS = False
- _TEST_FOOTERS = False
- _TEST_ONE_PASS = False
- _TRANSPOSE = False
- _USERNAME
- __setattr__(name, value)
Implement setattr(self, name, value).
- static _get_default_path()
- static _get_username()
- classmethod e_max()
Returns the upper limit integer before displaying in scientific notation.
- Returns:
e_max – Upper limit before going to scientific notation
- Return type:
- classmethod e_min()
Returns the lower limit integer before displaying in scientific notation.
- Returns:
e_min – lower limit before going to scientific notation.
- Return type:
- static load_config(path=None, name=None)
Load display config file from the default location if path and name are not supplied. Otherwise load display config settings using path and name. Return bool if applied correctly, otherwise return -1 if resetting display options.
- classmethod p_threshold()
Returns DisplayOption.P_THRESHOLD. Defaults to 10 ** (-1 * DisplayOptions.PRECISION) - 1e-5.
- Returns:
p_threshold – The precision threshold for area in between - so small values don’t display as zero
- Return type:
- static reset_config(path=None, name=None)
Reapply display config file from default location if path and name are not supplied. Otherwise override display config settings using path and name.
- static save_config(path=None, name=None, force_overwrite=False)
Save display options at the default config file path if path and name are not supplied. Otherwise save display options using path and name. If
force_overwrite
is True, then silently overwrite any previous configs at that file path, otherwise prompt for user input before overwrite.- Parameters:
- Returns:
result – True if config was saved, otherwise False.
- Return type: