log transform each value in table
192443
def log_trans(table):
    
    t = []
    all = [item for sublist in table for item in sublist]
    if min(all) == 0:
        scale = min([i for i in all if i != 0]) * 10e-10
    else:
        scale = 0
    for i in table:
        t.append(np.ndarray.tolist(np.log10([j + scale for j in i])))
    return t
726549
function recordTransformer(table){
	
	/**
	*	Process record transformation
	*/
	this.process = function( record ){
		if ( !table.name ){
			return;
		}
		var tableName = table.name.toLowerCase();
		if ( transformConfiguration.hasOwnProperty( tableName )){
			var requiredFields = transformConfiguration[tableName].requiredFields;
			if ( requiredFields ){
				_.forEach( requiredFields, function( fieldName ){
					if ( !record.hasOwnProperty(fieldName) || record[fieldName] == null ){
						record[fieldName] = "";
					}
				})
			}
		}
	}
}
756963
def upsert(self, table, value, update_columns=None, commit=True):
        
        if not isinstance(value, dict):
            raise TypeError('Input value should be a dictionary')

        if not update_columns:
            update_columns = value.keys()

        value_q, _args = self._value_parser(value, columnname=False)

        _sql = ''.join(['INSERT INTO ', self._backtick(table), ' (', self._backtick_columns(value), ') VALUES ',
                        '(', value_q, ') ',
                        'ON DUPLICATE KEY UPDATE ',
                        ', '.join(['='.join([k, 'VALUES('+k+')']) for k in update_columns]), ';'])

        if self.debug:
            return self.cur.mogrify(_sql, _args)

        self.cur.execute(_sql, _args)
        if commit:
            self.conn.commit()
        return self.cur.lastrowid
151973
def transform(row, table):
    ''

    data = row._asdict()
    data["link"] = urljoin("https://pt.wikipedia.org", data["link"])
    data["name"], data["state"] = regexp_city_state.findall(data["name"])[0]
    return data
301633
def print_log(value_color="", value_noncolor=""):
    """"""
    HEADER = '\033[92m'
    ENDC = '\033[0m'
    print(HEADER + value_color + ENDC + str(value_noncolor))
975561
function(table, feature, i){
    return 'insert into "'+table+'" (feature) VALUES (\''+JSON.stringify(feature).replace(/'/g, "").replace(/\(\)/g,'')+'\');';
  }
280299
def transform(fields, function, *tables):
    ""

    new_table = Table(fields=fields)

    for table in tables:
        for row in filter(bool, map(lambda row: function(row, table), table)):
            new_table.append(row)

    return new_table
550894
def tabulate(collection, headers, datetime_fmt='%Y-%m-%d %H:%M:%S', **kwargs):
    """"""
    if isinstance(headers, dict):
        attrs = headers.keys()
        # if mapping is not specified keep original
        names = [
            key if value is None else value for key, value in headers.items()
        ]
    else:
        attrs = names = headers
    table = [(
        format_cell(cell, datetime_fmt=datetime_fmt)
        for cell in attrgetter(*attrs)(c)
    ) for c in collection]
    return tblte(table, headers=[h.upper() for h in names], **kwargs)
1335072
function transformData( &$data, /* bool */ $toLocal )
    {
        // Check if it is already in correct format
        if ( isset( $data['_info']['format'] ) )
        {
            if ( $data['_info']['format'] == ( $toLocal ? 'local' : 'generic' ) )
                return true;
        }

        // Set the new format it will get
        $data['_info']['format'] = $toLocal ? 'local' : 'generic';

        // load the schema transformation rules
        $schemaType = $this->schemaType();
        $schemaTransformationRules = eZDBSchemaInterface::loadSchemaTransformationRules( $schemaType );
        if ( $schemaTransformationRules === false )
            return false;

        // transform column names
        foreach ( $schemaTransformationRules['column-name'] as $key => $val )
        {
            list( $tableName, $genericColName ) = explode( '.', $key );
            $localColName = $val;

            if ( $toLocal )
            {
                $searchColName = $genericColName;
                $replacementColName = $localColName;
            }
            else
            {
                $searchColName = $localColName;
                $replacementColName = $genericColName;
            }

            if ( !isset( $data[$tableName] ) )
                continue;

            // transform column names in tables
            $fieldsData = $data[$tableName]['fields'];
            foreach ( $fieldsData as $key => $fieldName )
            {
                if ( $searchColName == $fieldName )
                {
                    $data[$tableName]['fields'][$key] = $replacementColName;
                    eZDebugSetting::writeDebug( 'lib-dbschema-data-transformation', '',
                                                "transformed table column name $tableName.$searchColName to $replacementColName" );
                }
            }
        }

        return true;
    }
823168
private void logColumn(FastTrackColumn column)
   {
      if (m_log != null)
      {
         m_log.println("TABLE: " + m_currentTable.getType());
         m_log.println(column.toString());
         m_log.flush();
      }
   }
82195
def iter_to_table(value):
    """"""
    if isinstance(value, list):
        return _format_list(value)
    if isinstance(value, dict):
        return _format_dict(value)
    return value
1153912
def extract(self, content, output):
    """"""

    for table in self['tables']:

        # First apply default options.
        plugin_settings = DEFAULT_OPTIONS.copy()
        plugin_settings.update(table)
        table = plugin_settings

        # Validate settings
        assert 'start' in table, 'Table start regex missing'
        assert 'end' in table, 'Table end regex missing'
        assert 'body' in table, 'Table body regex missing'

        start = re.search(table['start'], content)
        end = re.search(table['end'], content)

        if not start or not end:
            logger.warning('no table body found - start %s, end %s', start, end)
            continue

        table_body = content[start.end(): end.start()]

        for line in re.split(table['line_separator'], table_body):
            # if the line has empty lines in it , skip them
            if not line.strip('').strip('\n') or not line:
                continue

            match = re.search(table['body'], line)
            if match:
                for field, value in match.groupdict().items():
                    # If a field name already exists, do not overwrite it
                    if field in output:
                        continue

                    if field.startswith('date') or field.endswith('date'):
                        output[field] = self.parse_date(value)
                        if not output[field]:
                            logger.error("Date parsing failed on date '%s'", value)
                            return None
                    elif field.startswith('amount'):
                        output[field] = self.parse_number(value)
                    else:
                        output[field] = value
            logger.debug('ignoring *%s* because it doesn\'t match anything', line)
947718
def generate_list_table_result(lexicon_logger, output=None, without_header=None):
    """"""
    if not isinstance(output, list):
        lexicon_logger.debug('Command output is not a list, and then cannot '
                             'be printed with --quiet parameter not enabled.')
        return None

    array = [[
        row.get('id', ''),
        row.get('type', ''),
        row.get('name', ''),
        row.get('content', ''),
        row.get('ttl', '')] for row in output]

    # Insert header (insert before calculating the max width of each column
    # to take headers size into account)
    if not without_header:
        headers = ['ID', 'TYPE', 'NAME', 'CONTENT', 'TTL']
        array.insert(0, headers)

    column_widths = [0, 0, 0, 0, 0]
    # Find max width for each column
    for row in array:
        for idx, col in enumerate(row):
            width = len(str(col))
            if width > column_widths[idx]:
                column_widths[idx] = width

    # Add a 'nice' separator
    if not without_header:
        array.insert(1, ['-' * column_widths[idx]
                         for idx in range(len(column_widths))])

    # Construct table to be printed
    table = []
    for row in array:
        row_list = []
        for idx, col in enumerate(row):
            row_list.append(str(col).ljust(column_widths[idx]))
        table.append(' '.join(row_list))

    # Return table
    return os.linesep.join(table)
761636
def tablify(*args):
    
    """
    table = []
    args = [listify(arg) for arg in args]
    for row in zip(*args):
        r = []
        for x in row:
            r += listify(x)
        table += [r]
    return table
    return [sum([listify(el) for el in row]) for row in zip(*args)]
556098
def _logmessage_transform(cls, s, by=2):
        
        if len(s) >= by:
            return s[by:].strip('\n')
        return s.strip('\n')
205533
def transform(row, table):
    ''

    data = row._asdict()
    data["links"] = " ".join(extract_links(row.project))
    for key, value in data.items():
        if isinstance(value, six.text_type):
            data[key] = extract_text(value)
    return data
777531
def convert_table(table):
    

    return dict((ord(k), v) for k, v in table.items())