radtools.print_2d_array#

radtools.print_2d_array(array, fmt='>.2f', highlight=False, print_result=True, borders=True, shift=0, header_row=None, footer_row=None, header_column=None, footer_column=None)[source]#

Print 1D and 2D arrays in the terminal.

Added in version 0.7.

Changed in version 0.7.11: Renamed from print_2D_array

Parameters:
array(N,) or (N, M) array-like

Array to be printed.

fmtstr, default ">.2f"

Format string.

highlightbool, default False

Whether to highlight positive and negative values. Only works for real-valued arrays.

Changed in version 0.7.11: Renamed from posneg

print_resultbool, default True

Whether to print the result or return it as a string.

bordersbool, default True

Whether to print borders around the array.

Added in version 0.7.11.

shiftint, default 0

Shifts the array to the right by shift columns.

Added in version 0.7.11.

header_rowlist, optional

Header of the table (top). Has to have the same length as the number of columns. Has to had one more element for each if header_column or footer_column is not None.

Added in version 0.8.0.

footer_rowlist, optional

Footer of the table (bottom). Has to have the same length as the number of columns. Has to had one more element for each if header_column or footer_column is not None.

Added in version 0.8.0.

header_columnlist, optional

Header of the table (left). Has to have the same length as the number of rows.

Added in version 0.8.0.

footer_columnlist, optional

Footer of the table (right). Has to have the same length as the number of rows.

Added in version 0.8.0.

Returns:
stringstr

String representation of the array. Returned only if print_result is False.