Add this instance as a row on a `astropy.table.Table`
495088
def update_table_row(self, table, row_idx):
        
        try:
            table[row_idx]['timestamp'] = self.timestamp
            table[row_idx]['status'] = self.status
        except IndexError:
            print("Index error", len(table), row_idx)
324567
def _SetTable(self, table):
    """"""
    if not isinstance(table, TextTable):
      raise TypeError('Not an instance of TextTable.')
    self.Reset()
    self._table = copy.deepcopy(table._table)   # pylint: disable=W0212
    # Point parent table of each row back ourselves.
    for row in self:
      row.table = self
948476
def table(self, header=None, rows=None, style=None):
        
        if style is not None:
            style = self.TABLE_STYLES[style]

        table = Table(style)

        if header:
            table.set_header_row(header)

        if rows:
            table.set_rows(rows)

        return table
972156
def generate_table(self, rows):
        
        table = PrettyTable(**self.kwargs)
        for row in self.rows:
            if len(row[0]) < self.max_row_width:
                appends = self.max_row_width - len(row[0])
                for i in range(1, appends):
                    row[0].append("-")

            if row[1] is True:
                self.make_fields_unique(row[0])
                table.field_names = row[0]
            else:
                table.add_row(row[0])
        return table
136752
def pretty_print_table(headers, rows):
    """"""
    table = make_table(headers=headers, rows=rows)
    pretty_print_table_instance(table)
824410
def ec2_table(instances):
    
    t = prettytable.PrettyTable(['ID', 'State', 'Monitored', 'Image', 'Name', 'Type', 'SSH key', 'DNS'])
    t.align = 'l'
    for i in instances:
        name = i.tags.get('Name', '')
        t.add_row([i.id, i.state, i.monitored, i.image_id, name, i.instance_type, i.key_name, i.dns_name])
    return t
459456
def addColumn(self, col, index=None):
        ''
        if col:
            if index is None:
                index = len(self.columns)
            col.sheet = self
            self.columns.insert(index, col)
            return col
111351
def insert(self, table, data_list, return_cols='id'):
        
        data_list = copy.deepcopy(data_list)  # Create deepcopy so the original list does not get modified
        # Make sure that `data_list` is a list
        if not isinstance(data_list, list):
            data_list = [data_list]
        # Make sure data_list has content
        if len(data_list) == 0:
            # No need to continue
            return []

        # Data in the list must be dicts (just check the first one)
        if not isinstance(data_list[0], dict):
            logger.critical("Data must be a list of dicts")
            # Do not return here, let the exception handle the error that will be thrown when the query runs

        # Make sure return_cols is a list
        if return_cols is None or len(return_cols) == 0 or return_cols[0] is None:
            return_cols = ''
        elif not isinstance(return_cols, list):
            return_cols = [return_cols]

        if len(return_cols) > 0:
            return_cols = 'RETURNING ' + ','.join(return_cols)

        try:
            with self.getcursor() as cur:
                query = "INSERT INTO {table} ({fields}) VALUES {values} {return_cols}"\
                        .format(table=table,
                                fields='"{0}"'.format('", "'.join(data_list[0].keys())),
                                values=','.join(['%s'] * len(data_list)),
                                return_cols=return_cols,
                                )
                values = []
                for row in [tuple(v.values()) for v in data_list]:
                    values.append(_check_values(row))

                query = cur.mogrify(query, values)
                cur.execute(query)

                try:
                    return cur.fetchall()
                except Exception:
                    return None

        except Exception as e:
            logger.exception("Error inserting data")
            logger.debug("Error inserting data: {data}".format(data=data_list))
            raise e.with_traceback(sys.exc_info()[2])
374947
def append(self, row_or_table):
        """"""
        if not row_or_table:
            return
        if isinstance(row_or_table, Table):
            t = row_or_table
            columns = list(t.select(self.labels)._columns.values())
            n = t.num_rows
        else:
            if (len(list(row_or_table)) != self.num_columns):
                raise Exception('Row should have '+ str(self.num_columns) + " columns")
            columns, n = [[value] for value in row_or_table], 1
        for i, column in enumerate(self._columns):
            if self.num_rows:
                self._columns[column] = np.append(self[column], columns[i])
            else:
                self._columns[column] = np.array(columns[i])
        self._num_rows += n
        return self
1357536
def add_row(self, text, link=None, bold=False, align=None):
        """"""
        if not self.table_columns_left:
            # Starting a new row
            self.write('<tr>')
            self.table_columns_left = self.table_columns

        self.write('<td')
        if align:
            self.write(' style="text-align:{}"', align)
        self.write('>')

        if bold:
            self.write('<b>')
        if link:
            self.write('<a href="{}">', self._rel(link))

        # Finally write the real table data, the given text
        self.write(text)

        if link:
            self.write('</a>')
        if bold:
            self.write('</b>')

        self.write('</td>')

        self.table_columns_left -= 1
        if not self.table_columns_left:
            self.write('</tr>')
1034169
def push(cell)
      cell = Workbook::Cell.new(cell, {row:self}) unless cell.class == Workbook::Cell
      super(cell)
    end
1109241
def put(cls, obj):
        
        return PyarrowOnRayFramePartition(ray.put(pyarrow.Table.from_pandas(obj)))
220307
def data_frame_to_astropy_table (dataframe):
    
    from astropy.utils import OrderedDict
    from astropy.table import Table, Column, MaskedColumn
    from astropy.extern import six

    out = OrderedDict()

    for name in dataframe.columns:
        column = dataframe[name]
        mask = np.array (column.isnull ())
        data = np.array (column)

        if data.dtype.kind == 'O':
            # If all elements of an object array are string-like or np.nan
            # then coerce back to a native numpy str/unicode array.
            string_types = six.string_types
            if six.PY3:
                string_types += (bytes,)
            nan = np.nan
            if all(isinstance(x, string_types) or x is nan for x in data):
                # Force any missing (null) values to b''.  Numpy will
                # upcast to str/unicode as needed.
                data[mask] = b''

                # When the numpy object array is represented as a list then
                # numpy initializes to the correct string or unicode type.
                data = np.array([x for x in data])

        if np.any(mask):
            out[name] = MaskedColumn(data=data, name=name, mask=mask)
        else:
            out[name] = Column(data=data, name=name)

    return Table(out)
501584
def table(table_name, options={}, &block)
      table = Mongify::Database::Table.new(table_name, options, &block)
      add_table(table)
    end
763662
def _init_table(self):
        
        self.observation_table.sm_vector.append(self.epsilon)
        self.observation_table.smi_vector = list(self.alphabet)
        self.observation_table.em_vector.append(self.epsilon)

        self._fill_table_entry(self.epsilon, self.epsilon)
        for s in self.observation_table.smi_vector:
            self._fill_table_entry(s, self.epsilon)
1219096
def add_row(self, label='', item=''):
        
        self.AppendRows(1)
        last_row = self.GetNumberRows() - 1
        self.SetCellValue(last_row, 0, str(label))
        self.row_labels.append(label)
        self.row_items.append(item)
949414
def add_row(row)
      size = row.size
      raise ArgumentError.new("Given a row of data with #{size} entries, but there are only #{@table_columns.size} columns in the table") unless size == @table_columns.size
      @data << row
    end