Put the variableNames with the corresponding column data.
        :param list names: variableNames
        :param list cols: List of Lists of column data
        :return dict:
973397
def __put_names_on_csv_cols(names, cols):
        
        _combined = {}
        for idx, name in enumerate(names):
            # Use the variableName, and the column data from the same index
            _combined[name] = cols[idx]



        return _combined
1012965
def _compile_update_columns(self, values):
        
        columns = []

        for key, value in values.items():
            columns.append("%s = %s" % (self.wrap(key), self.parameter(value)))

        return ", ".join(columns)
256012
def set_column_names(self, column_names):
        
        if len(self._rows):
            raise NotImplementedError("You can't manually set columns once data has been added")

        self._update_internal_column_state(column_names)
396285
def mkcols(l, rows):
    '''
    
    '''
    cols = []
    base = 0
    while len(l) > rows and len(l) % rows != 0:
        l.append("")
    for i in range(rows, len(l) + rows, rows):
        cols.append(l[base:i])
        base = i
    return cols
459371
def merge_indexes(
        indexes,  # type: Dict[Any, Union[Any, List[Any]]]
        variables,  # type: Dict[Any, Variable]
        coord_names,  # type: Set
        append=False,  # type: bool
):
    # type: (...) -> Tuple[OrderedDict[Any, Variable], Set]
    
    vars_to_replace = {}  # Dict[Any, Variable]
    vars_to_remove = []  # type: list

    for dim, var_names in indexes.items():
        if isinstance(var_names, str):
            var_names = [var_names]

        names, codes, levels = [], [], []  # type: (list, list, list)
        current_index_variable = variables.get(dim)

        for n in var_names:
            var = variables[n]
            if (current_index_variable is not None and
                    var.dims != current_index_variable.dims):
                raise ValueError(
                    "dimension mismatch between %r %s and %r %s"
                    % (dim, current_index_variable.dims, n, var.dims))

        if current_index_variable is not None and append:
            current_index = current_index_variable.to_index()
            if isinstance(current_index, pd.MultiIndex):
                try:
                    current_codes = current_index.codes
                except AttributeError:
                    # fpr pandas<0.24
                    current_codes = current_index.labels
                names.extend(current_index.names)
                codes.extend(current_codes)
                levels.extend(current_index.levels)
            else:
                names.append('%s_level_0' % dim)
                cat = pd.Categorical(current_index.values, ordered=True)
                codes.append(cat.codes)
                levels.append(cat.categories)

        if not len(names) and len(var_names) == 1:
            idx = pd.Index(variables[var_names[0]].values)

        else:
            for n in var_names:
                names.append(n)
                var = variables[n]
                cat = pd.Categorical(var.values, ordered=True)
                codes.append(cat.codes)
                levels.append(cat.categories)

            idx = pd.MultiIndex(levels, codes, names=names)

        vars_to_replace[dim] = IndexVariable(dim, idx)
        vars_to_remove.extend(var_names)

    new_variables = OrderedDict([(k, v) for k, v in variables.items()
                                 if k not in vars_to_remove])
    new_variables.update(vars_to_replace)
    new_coord_names = coord_names | set(vars_to_replace)
    new_coord_names -= set(vars_to_remove)

    return new_variables, new_coord_names
1051597
private static void insertToColumnList(
            List<ParsedColInfo> columnList, List<ParsedColInfo> newCols) {
        for (ParsedColInfo col : newCols) {
            if (!columnList.contains(col)) {
                columnList.add(col);
            }
        }
    }
144937
def format_variable_map(variable_map, join_lines=True):
  """"""
  rows = []
  rows.append(("Key", "Variable", "Shape", "Type", "Collections", "Device"))
  var_to_collections = _get_vars_to_collections(variable_map)

  sort_key = lambda item: (item[0], item[1].name)
  for key, var in sorted(variable_map_items(variable_map), key=sort_key):
    shape = "x".join(str(dim) for dim in var.get_shape().as_list())
    dtype = repr(var.dtype.base_dtype).replace("tf.", "")
    coll = ", ".join(sorted(var_to_collections[var]))
    rows.append((key, var.op.name, shape, dtype, coll, _format_device(var)))
  return _format_table(rows, join_lines)
69954
def _idx_col_by_name(table):
    
    _columns = OrderedDict()

    # Iter for each column in the list
    try:
        for _column in table["columns"]:
            try:
                _name = _column["variableName"]
                if _name in _columns:
                    _name = get_appended_name(_name, _columns)
                _columns[_name] = _column
            except Exception as e:
                print("Error: idx_col_by_name: inner: {}".format(e))
                logger_jsons.info("idx_col_by_name: inner: {}".format(e))

        table["columns"] = _columns
    except Exception as e:
        print("Error: idx_col_by_name: {}".format(e))
        logger_jsons.error("idx_col_by_name: {}".format(e))

    return table
905799
def get_join_cols(by_entry):
  
  left_cols = []
  right_cols = []
  for col in by_entry:
    if isinstance(col, str):
      left_cols.append(col)
      right_cols.append(col)
    else:
      left_cols.append(col[0])
      right_cols.append(col[1])
  return left_cols, right_cols
721685
def __write_variables_2(self, col):
        
        col = self.__convert_keys_1("Variables", col)

        # Write one line for each column. One line has all metadata for one column.
        for entry in NOAA_KEYS_BY_SECTION["Variables"]:
            # May need a better way of handling this in the future. Need a strict list for this section.
            try:
                # First entry: Add extra hash and tab
                if entry == 'shortname':
                    # DEPRECATED: Fixed spacing for variable names.
                    # self.noaa_txt.write('{:<20}'.format('#' + str(col[entry])))
                    # Fluid spacing for variable names. Spacing dependent on length of variable names.
                    self.noaa_txt += '{}\t'.format('#' + str(col[entry]))
                # Last entry: No space or comma
                elif entry == "additional":
                    e = " "
                    for item in ["notes", "uncertainty"]:
                        try:
                            if col[item]:
                                e += str(col[item]).replace(",", ";") + "; "
                        except KeyError:
                            pass
                    self.noaa_txt += '{} '.format(e)

                # elif entry == 'notes':
                #     self.noaa_txt.write('{} '.format(str(col[entry])))
                else:
                    # This is for any entry that is not first or last in the line ordering
                    # Account for nested entries.
                    # if entry == "uncertainty":
                    #     try:
                    #         e = str(col["calibration"][entry])
                    #     except KeyError:
                    #         e = ""
                    if entry == "seasonality":
                        try:
                            e = str(col["climateInterpretation"][entry])
                        except KeyError:
                            e = ""
                    elif entry == "archive":
                        e = self.noaa_data_sorted["Top"]["Archive"]
                    elif entry == "dataType":
                        # Lipd uses real data types (floats, ints), NOAA wants C or N (character or numeric)
                        if col[entry] == "float":
                            e = "N"
                        else:
                            e = "C"
                    else:
                        e = str(col[entry])
                    try:
                        e = e.replace(",", ";")
                    except AttributeError as ee:
                        logger_lpd_noaa.warn("write_variables_2: AttributeError: {}, {}".format(e, ee))
                    self.noaa_txt += '{}, '.format(e)
            except KeyError as e:
                self.noaa_txt += '{:<0}'.format(',')
                logger_lpd_noaa.info("write_variables: KeyError: missing {}".format(e))
        self.noaa_txt += '\n#'
        return
988842
def save_list(self, list_name, emails):
        
        data = {'list': list_name,
                'emails': ','.join(emails) if isinstance(emails, list) else emails}
        return self.api_post('list', data)
1006643
def _columns_for_table(table_name):
    
    return {cname: col
            for (tname, cname), col in _COLUMNS.items()
            if tname == table_name}
1278660
def get_order_columns_list(self, list_columns=None):
        
        ret_lst = list()
        list_columns = list_columns or self.get_columns_list()
        for col_name in list_columns:
            if hasattr(self.obj, col_name):
                if not hasattr(getattr(self.obj, col_name), "__call__"):
                    ret_lst.append(col_name)
            else:
                ret_lst.append(col_name)
        return ret_lst
426787
def dataframe(df, **kwargs):
    
    table(df.values, list(df.columns), **kwargs)
738879
def _fieldnames_to_colnames(model_cls, fieldnames):
        """"""
        get_field = model_cls._meta.get_field
        fields = map(get_field, fieldnames)
        return {f.column for f in fields}
85636
def get_col_data_by_name(self, col_name, WHERE_Clause=''):
        
        #print('get_col_data_by_name: col_name = ', col_name, ' WHERE = ', WHERE_Clause)
        col_key = self.get_col_by_name(col_name)
        if col_key is None:
            print('get_col_data_by_name: col_name = ', col_name, ' NOT FOUND')
            return []
        #print('get_col_data_by_name: col_key =', col_key)
        res = []
        for row in self.arr:
            #print('col_key=',col_key, ' len(row)=', len(row), ' row=', row)
            res.append(row[col_key])  # need to convert to int for calcs but leave as string for lookups
        return res
1008970
def df(self, qname_predicates:bool=False, keep_variable_type:bool=True) -> pd.DataFrame:
        '''  '''
        local_df = self.df.copy()
        if qname_predicates:
            for col in self.columns:
                local_df.rename({col: self.g.qname(col)})
        if not keep_variable_type:
            pass
            # convert all to strings, watch out for lists
        return local_df