get the number of columns and also rebuild resizer rows if the count is different than the last count
766231
function columnNum(){
        var count;
        var $headerColumns = $header.find(opts.headerCellSelector);
        if(existingColGroup){
          count = $tableColGroup.find('col').length;
        } else {
          count = 0;
          $headerColumns.each(function () {
            count += parseInt(($(this).attr('colspan') || 1), 10);
          });
        }
        if(count !== lastColumnCount){
          lastColumnCount = count;
          var cells = [], cols = [], psuedo = [], content;
          for(var x = 0; x < count; x++){
            content = $headerColumns.eq(x).text();
            cells.push('<th class="floatThead-col" aria-label="'+content+'"/>');
            cols.push('<col/>');
            psuedo.push(
              $('<fthtd>').css({
                'display': 'table-cell',
                'height': 0,
                'width': 'auto'
              })
            );
          }

          cols = cols.join('');
          cells = cells.join('');

          if(createElements){
            $fthRow.empty();
            $fthRow.append(psuedo);
            $fthCells = $fthRow.find('fthtd');
          }

          $sizerRow.html(cells);
          $sizerCells = $sizerRow.find("th");
          if(!existingColGroup){
            $tableColGroup.html(cols);
          }
          $tableCells = $tableColGroup.find('col');
          $floatColGroup.html(cols);
          $headerCells = $floatColGroup.find("col");

        }
        return count;
      }
130685
def get_rowspanned_columns(self):
        """"""
        spanned_columns = {}
        current_row_index = self._index
        current_row_cols = sum(cell.colspan for cell in self)
        prev_rows = iter(reversed(self.section[:current_row_index]))
        while current_row_cols < self.section.num_columns:
            row = next(prev_rows)
            min_rowspan = current_row_index - int(row._index)
            if row.maximum_rowspan > min_rowspan:
                for cell in (c for c in row if c.rowspan > min_rowspan):
                    col_index = int(cell.column_index)
                    spanned_columns[col_index] = cell.colspan
                    current_row_cols += cell.colspan
        return spanned_columns
940615
function findColMergedLastIndex(tableData, rowIndex, colIndex) {
  const cellData = tableData[rowIndex][colIndex];
  let foundColIndex = colIndex;

  if (cellData.colspan > 1) {
    foundColIndex += cellData.colspan - 1;
  }

  return foundColIndex;
}
1174853
protected int getNumOfCols() {
        if (!columns.isEmpty()) return getHeadRegularColCnt() + columns.size();
        if (loaded && !colTitleWidgets.isEmpty()) return getHeadRegularColCnt() + colTitleWidgets.size();
        return getHeadRegularColCnt();
    }
826417
def _get_no_rowscols(self, bbox):
        """"""

        if bbox is None:
            return 1, 1
        else:
            (bb_top, bb_left), (bb_bottom, bb_right) = bbox
            if bb_top is None:
                bb_top = 0
            if bb_left is None:
                bb_left = 0
            if bb_bottom is None:
                bb_bottom = self.grid.code_array.shape[0] - 1
            if bb_right is None:
                bb_right = self.grid.code_array.shape[1] - 1

            return bb_bottom - bb_top + 1, bb_right - bb_left + 1
679158
def num_columns(self):
        """"""
        if self.term.is_a_tty:
            return self.term.width // self.hint_width
        return 1
899378
def OnRowSize(self, event):
        """"""

        row = event.GetRowOrCol()
        tab = self.grid.current_table
        rowsize = self.grid.GetRowSize(row) / self.grid.grid_renderer.zoom

        # Detect for resizing group of rows
        rows = self.grid.GetSelectedRows()
        if len(rows) == 0:
            rows = [row, ]

        # Detect for selection of rows spanning all columns
        selection = self.grid.selection
        num_cols = self.grid.code_array.shape[1]-1
        for box in zip(selection.block_tl, selection.block_br):
            leftmost_col = box[0][1]
            rightmost_col = box[1][1]
            if leftmost_col == 0 and rightmost_col == num_cols:
                rows += range(box[0][0], box[1][0]+1)

        # All row resizing is undone in one click
        with undo.group(_("Resize Rows")):
            for row in rows:
                self.grid.code_array.set_row_height(row, tab, rowsize)
                zoomed_rowsize = rowsize * self.grid.grid_renderer.zoom
                self.grid.SetRowSize(row, zoomed_rowsize)

        # Mark content as changed
        post_command_event(self.grid.main_window, self.grid.ContentChangedMsg)

        event.Skip()
        self.grid.ForceRefresh()
903409
def _get_cols_width(self):
        """"""

        tab = self.grid.current_table
        no_cols = self.grid.code_array.shape[1]
        default_col_width = self.grid.code_array.cell_attributes.\
            default_cell_attributes["column-width"]

        non_standard_col_widths = []
        __col_widths = self.grid.code_array.col_widths
        for __col, __tab in __col_widths:
            if __tab == tab:
                non_standard_col_widths.append(__col_widths[(__col, __tab)])

        cols_width = sum(non_standard_col_widths)
        cols_width += \
            (no_cols - len(non_standard_col_widths)) * default_col_width

        return cols_width
129735
def calc_columns_rows(n):
    
    num_columns = int(ceil(sqrt(n)))
    num_rows = int(ceil(n / float(num_columns)))
    return (num_columns, num_rows)
1279953
function (obj, count, index) {
    if (obj) {
      if (typeof index !== 'undefined') {
        return obj.columnLabel(index);
      }
      else {
        var headers = [];
        for (var i = 0; i < count; i++) {
          headers.push(obj.columnLabel(i));
        }
        return headers;
      }
    }
  }
1234957
def rearrange
      # Calculate the number of the dynamic dimension.
      case @type
      when :fixed_rows
        @num_columns = (size / @num_rows.to_f).ceil
      when :fixed_columns
        @num_rows = (size / @num_columns.to_f).ceil
      end

      # Create an array containing all the rows.
      @rows = case @type
      when :fixed_rows
        # Rearrange the list, arranged by columns, into rows.
        rows = Array.new(@num_rows) { [] }
        @children.each_with_index do |child, i|
          rows[i % @num_rows].push child
        end
        rows
      when :fixed_columns
        @children.each_slice(@num_columns).to_a
      end

      nil
    end
962968
def _resizeColumnsToContents(self, header, data, limit_ms):
        """"""
        max_col = data.model().columnCount()
        if limit_ms is None:
            max_col_ms = None
        else:
            max_col_ms = limit_ms / max(1, max_col)
        for col in range(max_col):
            self._resizeColumnToContents(header, data, col, max_col_ms)
755558
def get_csv_col_headers(rows, row_headers_count_value=0):
    
    count = 0

    if rows:
        for row in rows:
            if exclude_empty_values(row[:row_headers_count_value]):
                break
            count += 1

    if len(rows) == count:
        count = 1  # by default

    return [r[row_headers_count_value:] for r in rows[:count]]
585821
function getWidths(tableGrid, isPercentageBased, table) {

        var cols = getColumnBlocks(tableGrid);

        var backups = Tools.map(cols, function (col) {
          return getInnerEdge(col.colIndex, col.element).x;
        });

        var widths = [];

        for (var i = 0; i < cols.length; i++) {
          var span = cols[i].element.hasAttribute('colspan') ? parseInt(cols[i].element.getAttribute('colspan'), 10) : 1;
          // Deduce if the column has colspan of more than 1
          var width = span > 1 ? deduceSize(backups, i) : getWidth(cols[i].element, isPercentageBased, table);
          // If everything's failed and we still don't have a width
          width = width ? width : RESIZE_MINIMUM_WIDTH;
          widths.push(width);
        }

        return widths;
      }
1065329
def column_count(index = Celerity.index_offset)
      assert_exists
      @object.getRow(index - Celerity.index_offset).getCells.length
    end
660164
def get_ensemble_counts(d):
    
    _rows_cols = {"rows": 0, "cols": 0}
    try:

        if len(d) == 1:
            for var, data in d.items():
                # increment columns by one
                _rows_cols["cols"] += len(data["values"])
                # get row count by getting len of column (since it's only one list
                _rows_cols["rows"] = len(data["values"][0])
                break

        elif len(d) == 2:
            for var, data in d.items():
                # multiple columns in one. list of lists
                if isinstance(data["number"], list):
                    # add total amount of columns to the running total
                    _rows_cols["cols"] += len(data["values"])
                # single column. one list
                else:
                    # increment columns by one
                    _rows_cols["cols"] += 1
                    # get row count by getting len of column (since it's only one list
                    _rows_cols["rows"] = len(data["values"])

    except Exception as e:
        logger_misc.warn("get_ensemble_counts: {}".format(e))

    return _rows_cols
432483
def columnCount(self, index=QModelIndex()):
        """"""
        # Avoid a "Qt exception in virtual methods" generated in our
        # tests on Windows/Python 3.7
        # See PR 8910
        try:
            # This is done to implement series
            if len(self.df.shape) == 1:
                return 2
            elif self.total_cols <= self.cols_loaded:
                return self.total_cols
            else:
                return self.cols_loaded
        except AttributeError:
            return 0