Print table with data from the given pandas DataFrame

    Parameters
    ----------
    df : DataFrame
        A pandas DataFrame with the table to print
426787
def dataframe(df, **kwargs):
    
    table(df.values, list(df.columns), **kwargs)
866805
def as_dframe(cls, dataset):
        
        if issubclass(dataset.interface, PandasInterface):
            return dataset.data
        else:
            return dataset.dframe()
1198953
def _print_tabulate_data(headers, data, table_format):  # pragma: no cover
    
    print(tabulate.tabulate(data, headers, tablefmt=table_format))
653382
def pprint_table(table):
    
    col_paddings = []
    for i in range(len(table[0])):
        col_paddings.append(get_max_width(table,i))
    for row in table:
        print(row[0].ljust(col_paddings[0] + 1), end="")
        for i in range(1, len(row)):
            col = str(row[i]).rjust(col_paddings[i]+2)
            print(col, end='')
        print("\n")
183933
def _render_dataframe(dataframe):
  """"""
  data = dataframe.to_dict(orient='records')
  fields = dataframe.columns.tolist()
  return IPython.core.display.HTML(
      datalab.utils.commands.HtmlBuilder.render_table(data, fields))
436843
def print_row(*argv):
    
    #for i in range(0, len(argv)):
        # row += f"{argv[i]}"
    # columns
    row = ""
    # id
    row += f"{argv[0]:<3}"
    # name
    row += f" {argv[1]:<13}"
    # allocation
    row += f" {argv[2]:>5}"
    # level
    #row += f"{argv[3]}"

    print(row)
990601
def print_table(data):
    
    table = AsciiTable([COLUMNS])
    table.justify_columns[2] = 'right'
    table.justify_columns[3] = 'right'
    table.justify_columns[4] = 'right'
    table_data = list()
    for row_in in data:
        row_out = [
            str(row_in.get('ssid', '')).replace('\0', ''),
            str(row_in.get('security', '')),
            str(row_in.get('channel', '')),
            str(row_in.get('frequency', '')),
            str(row_in.get('signal', '')),
            str(row_in.get('bssid', '')),
        ]
        if row_out[3]:
            row_out[3] += ' MHz'
        if row_out[4]:
            row_out[4] += ' dBm'
        table_data.append(row_out)

    sort_by_column = [c.lower() for c in COLUMNS].index(OPTIONS['--key'].lower())
    table_data.sort(key=lambda c: c[sort_by_column], reverse=OPTIONS['--reverse'])

    table.table_data.extend(table_data)
    print(table.table)
366190
def new_db_from_pandas(self, frame, table=None, data=None, load=True, **kwargs):
        

        from ..orm import Column
        # from dbexceptions import ConfigurationError

        # Create the table from the information in the data frame.
        with self.bundle.session:
            sch = self.bundle.schema
            t = sch.new_table(table)

            if frame.index.name:
                id_name = frame.index.name
            else:
                id_name = 'id'

            sch.add_column(t, id_name,
                           datatype=Column.convert_numpy_type(frame.index.dtype),
                           is_primary_key=True)

            for name, type_ in zip([row for row in frame.columns],
                                   [row for row in frame.convert_objects(convert_numeric=True,
                                                                         convert_dates=True).dtypes]):
                sch.add_column(t, name, datatype=Column.convert_numpy_type(type_))
                sch.write_schema()

        p = self.new_partition(table=table, data=data, **kwargs)

        if load:
            pk_name = frame.index.name
            with p.inserter(table) as ins:
                for i, row in frame.iterrows():
                    d = dict(row)
                    d[pk_name] = i

                    ins.insert(d)
        return p
326733
def make_dash_table(df):
    '''  '''
    table = []
    for index, row in df.iterrows():
        html_row = []
        for i in range(len(row)):
            html_row.append(html.Td([row[i]]))
        table.append(html.Tr(html_row))
    return table
558170
def datatable_df(self):
        
        data = self._all_datatable_data()
        adf = pd.DataFrame(data)
        adf.columns = self.dt_all_cols
        return self._finish_df(adf, 'ALL')
465599
def print_horiz_table(self, data):
        """"""

        # Build list of returned objects
        return_objects = list()
        fields = self.job_args.get('fields')
        if not fields:
            fields = set()
            for item_dict in data:
                for field_item in item_dict.keys():
                    fields.add(field_item)
            fields = sorted(fields)

        for obj in data:
            item_struct = dict()
            for item in fields:
                item_struct[item] = obj.get(item)
            else:
                return_objects.append(item_struct)

        table = prettytable.PrettyTable(fields)
        for obj in return_objects:
            table.add_row([obj.get(i) for i in fields])

        for tbl in table.align.keys():
            table.align[tbl] = 'l'

        sort_key = self.job_args.get('sort_by')
        if sort_key:
            table.sortby = sort_key

        self.printer(table)
882274
def rados_parse_df(self,
                       result):
        '''
        
        '''
        parsed_results = []
        HEADING = r".*(pool name) *(category) *(KB) *(objects) *(clones)" + \
            " *(degraded) *(unfound) *(rd) *(rd KB) *(wr) *(wr KB)"

        HEADING_RE = re.compile(HEADING,
                                re.IGNORECASE)

        dict_keys = ["pool_name", "category", "size_kb", "objects",
                     "clones", "degraded", "unfound", "rd", "rd_kb",
                     "wr", "wr_kb"]

        if result['contacted'].keys():
            for node in result['contacted'].keys():
                df_result = {}
                nodeobj = result['contacted'][node]
                df_output = nodeobj['stdout']
                for line in df_output.splitlines():
                    print "Line: ", line
                    # Skip the heading line.
                    reobj = HEADING_RE.match(line)
                    if not reobj:
                        row = line.split()
                        if len(row) != len(dict_keys):
                            print "line not match: ", line
                            continue

                        key_count = 0
                        for column in row:
                            df_result[dict_keys[key_count]] = column
                            key_count += 1
                        print "df_result: ", df_result
                        parsed_results.append(df_result)

                    nodeobj['parsed_results'] = parsed_results

        return result
1020281
def load_data(self, df):
        
        stmt = ddl.LoadData(self._qualified_name, df)
        return self._execute(stmt)
277044
def print_table(document, *columns):
    
    headers = []
    for _, header in columns:
        headers.append(header)
    table = []
    for element in document:
        row = []
        for item, _ in columns:
            if item in element:
                row.append(element[item])
            else:
                row.append(None)
        table.append(row)
    print(tabulate.tabulate(table, headers))
1093238
def db_from_dataframe(
        db_filename,
        table_name,
        df,
        primary_key=None,
        subdir=None,
        overwrite=False,
        indices=(),
        version=1):
    
    return db_from_dataframes(
        db_filename=db_filename,
        dataframes={table_name: df},
        primary_keys={table_name: primary_key},
        indices={table_name: indices},
        subdir=subdir,
        overwrite=overwrite,
        version=version)
1289186
def load_df(self, df):
    '''
    
    '''
    # self.__init__()
    self.reset()

    df_dict = {}
    df_dict['mat'] = deepcopy(df)
    # always define category colors if applicable when loading a df
    data_formats.df_to_dat(self, df_dict, define_cat_colors=True)
1274066
def print_data(data):
    
    print(", ".join(["{}=>{}".format(key, value) for key, value in data]))