class_docstr: CLI describes a command line interface for interacting with igel, there
  are several different functions that can be performed.
class_docstr_tok: ["CLI","describes","a","command","line","interface","for","interacting","with","igel",",","there","are","several","different","functions","that","can","be","performed","."]
docstr: pretty-print a dataframe as table
docstr_tok: ["pretty-print","a","dataframe","as","table"]
code: def _tableize(self, df):
      """
      pretty-print a dataframe as table
      """
      if not isinstance(df, pd.DataFrame):
          return
      df_columns = df.columns.tolist()
      max_len_in_lst = lambda lst: len(
          sorted(lst, reverse=True, key=len)[0]
      )
      align_center = (
          lambda st, sz: "{0}{1}{0}".format(
              " " * (1 + (sz - len(st)) // 2), st
          )[:sz]
          if len(st) < sz
          else st
      )
      align_right = (
          lambda st, sz: "{}{} ".format(" " * (sz - len(st) - 1), st)
          if len(st) < sz
          else st
      )
      max_col_len = max_len_in_lst(df_columns)
      max_val_len_for_col = {
          col: max_len_in_lst(df.iloc[:, idx].astype("str"))
          for idx, col in enumerate(df_columns)
      }
      col_sizes = {
          col: 2 + max(max_val_len_for_col.get(col, 0), max_col_len)
          for col in df_columns
      }
      build_hline = lambda row: "+".join(
          ["-" * col_sizes[col] for col in row]
      ).join(["+", "+"])
      build_data = lambda row, align: "|".join(
          [
              align(str(val), col_sizes[df_columns[idx]])
              for idx, val in enumerate(row)
          ]
      ).join(["|", "|"])
      hline = build_hline(df_columns)
      out = [hline, build_data(df_columns, align_center), hline]
      for _, row in df.iterrows():
          out.append(build_data(row.tolist(), align_right))
      out.append(hline)
      return "\n".join(out)
  
imports: import argparse
  import logging
  import os
  import subprocess
  import sys
  from pathlib import Path
  import igel
  import pandas
  from igel import Igel, metrics_dict, models_dict
  from igel.constants import Constants
  from igel.servers import fastapi_server
label_desc: Use image node_id 18 for calling the CLI obj's underlying member method code with example usage: obj._tableize(df) and returns: str