Returns a converter that takes in a value and turns it into an integer, if necessary.

        Args:
            col_name(str): Name of the column.
            subtype(str): Numeric subtype of the values.

        Returns:
            function
439662
def safe_round(self, x):
        
        val = x[self.col_name]

        if np.isposinf(val):
            val = sys.maxsize

        elif np.isneginf(val):
            val = -sys.maxsize

        if np.isnan(val):
            val = self.default_val

        if self.subtype == 'integer':
            return int(round(val))

        return val
1023194
def col2name(col_item):
  ""
  if isinstance(col_item, sqparse2.NameX): return col_item.name
  elif isinstance(col_item, sqparse2.AliasX): return col_item.alias
  else: raise TypeError(type(col_item), col_item)
175672
def get_colname(self, colnum):
        
        if colnum < 0 or colnum > (len(self._colnames)-1):
            raise ValueError(
                "colnum out of range [0,%s-1]" % (0, len(self._colnames)))
        return self._colnames[colnum]
27958
def _convert_value(vtype, value):
        
        # Normalize value
        value = value.strip()

        if vtype == TYPE_STRING:
            # Nothing to do
            return value
        elif vtype in TYPES_INT:
            return int(value)
        elif vtype in TYPES_FLOAT:
            return float(value)
        elif vtype in TYPES_BOOLEAN:
            # Compare lower-case value
            return value.lower() not in ("false", "0")
        elif vtype in TYPES_CHAR:
            return value[0]

        # No luck
        raise ValueError("Unknown value type: {0}".format(vtype))
237733
def __get_subscript(self, name, ctx=None):
    

    assert isinstance(name, string_types), name
    return ast.Subscript(
      value=ast.Name(id=self.data_var, ctx=ast.Load()),
      slice=ast.Index(value=ast.Str(s=name)),
      ctx=ctx)
515670
def _create_converter(dataType):
    
    if not _need_converter(dataType):
        return lambda x: x

    if isinstance(dataType, ArrayType):
        conv = _create_converter(dataType.elementType)
        return lambda row: [conv(v) for v in row]

    elif isinstance(dataType, MapType):
        kconv = _create_converter(dataType.keyType)
        vconv = _create_converter(dataType.valueType)
        return lambda row: dict((kconv(k), vconv(v)) for k, v in row.items())

    elif isinstance(dataType, NullType):
        return lambda x: None

    elif not isinstance(dataType, StructType):
        return lambda x: x

    # dataType must be StructType
    names = [f.name for f in dataType.fields]
    converters = [_create_converter(f.dataType) for f in dataType.fields]
    convert_fields = any(_need_converter(f.dataType) for f in dataType.fields)

    def convert_struct(obj):
        if obj is None:
            return

        if isinstance(obj, (tuple, list)):
            if convert_fields:
                return tuple(conv(v) for v, conv in zip(obj, converters))
            else:
                return tuple(obj)

        if isinstance(obj, dict):
            d = obj
        elif hasattr(obj, "__dict__"):  # object
            d = obj.__dict__
        else:
            raise TypeError("Unexpected obj type: %s" % type(obj))

        if convert_fields:
            return tuple([conv(d.get(name)) for name, conv in zip(names, converters)])
        else:
            return tuple([d.get(name) for name in names])

    return convert_struct
472219
def type_converter(text):
    
    if text.isdigit():
        return int(text), int

    try:
        return float(text), float
    except ValueError:
        return text, STRING_TYPE
1272784
def get(self, col_str):
        '''
        

        '''
        data_column=zeros(self.ilines)
        for i in range(self.ilines):
            data_column[i]=self.data[i][self.col_num[col_str]]
        return data_column
939655
def _handle_usecols(self, columns, usecols_key):
        
        if self.usecols is not None:
            if callable(self.usecols):
                col_indices = _evaluate_usecols(self.usecols, usecols_key)
            elif any(isinstance(u, str) for u in self.usecols):
                if len(columns) > 1:
                    raise ValueError("If using multiple headers, usecols must "
                                     "be integers.")
                col_indices = []

                for col in self.usecols:
                    if isinstance(col, str):
                        try:
                            col_indices.append(usecols_key.index(col))
                        except ValueError:
                            _validate_usecols_names(self.usecols, usecols_key)
                    else:
                        col_indices.append(col)
            else:
                col_indices = self.usecols

            columns = [[n for i, n in enumerate(column) if i in col_indices]
                       for column in columns]
            self._col_indices = col_indices
        return columns
932136
def num_col(self):
        
        ret = ctypes.c_uint()
        _check_call(_LIB.XGDMatrixNumCol(self.handle,
                                         ctypes.byref(ret)))
        return ret.value
1090400
def col(self, col_name_or_num):
        
        if isinstance(col_name_or_num, basestring):
            return self[col_name_or_num]
        elif isinstance(col_name_or_num, (int, long)):
            if col_name_or_num > len(self.fields):
                raise IndexError("Invalid column index `%s` for DataTable" %
                                 col_name_or_num)
            return self.__data[self.fields[col_name_or_num]]
864070
function Column(typeOrOptions, options) {
    return function (object, propertyName) {
        if (typeOrOptions instanceof Function)
            class_transformer_1.Type(typeOrOptions)(object, propertyName);
    };
}
182052
def reverse_transform(self, column):
        
        self.check_data_type()

        return pd.DataFrame({self.col_name: np.log(column[self.col_name])})
1047577
def _get_column_value(self, obj, column):
        
        return self._get_formatted_val(obj, column['__col__'].key, column)
154445
def convert_column(data, schemae):
    """"""
    ctype = schemae.converted_type
    if ctype == parquet_thrift.ConvertedType.DECIMAL:
        scale_factor = Decimal("10e-{}".format(schemae.scale))
        if schemae.type == parquet_thrift.Type.INT32 or schemae.type == parquet_thrift.Type.INT64:
            return [Decimal(unscaled) * scale_factor for unscaled in data]
        return [Decimal(intbig(unscaled)) * scale_factor for unscaled in data]
    elif ctype == parquet_thrift.ConvertedType.DATE:
        return [datetime.date.fromordinal(d) for d in data]
    elif ctype == parquet_thrift.ConvertedType.TIME_MILLIS:
        return [datetime.timedelta(milliseconds=d) for d in data]
    elif ctype == parquet_thrift.ConvertedType.TIMESTAMP_MILLIS:
        return [datetime.datetime.utcfromtimestamp(d / 1000.0) for d in data]
    elif ctype == parquet_thrift.ConvertedType.UTF8:
        return [codecs.decode(item, "utf-8") for item in data]
    elif ctype == parquet_thrift.ConvertedType.UINT_8:
        return _convert_unsigned(data, 'b')
    elif ctype == parquet_thrift.ConvertedType.UINT_16:
        return _convert_unsigned(data, 'h')
    elif ctype == parquet_thrift.ConvertedType.UINT_32:
        return _convert_unsigned(data, 'i')
    elif ctype == parquet_thrift.ConvertedType.UINT_64:
        return _convert_unsigned(data, 'q')
    elif ctype == parquet_thrift.ConvertedType.JSON:
        return [json.loads(s) for s in codecs.iterdecode(data, "utf-8")]
    elif ctype == parquet_thrift.ConvertedType.BSON and bson:
        return [bson.BSON(s).decode() for s in data]
    else:
        logger.info("Converted type '%s'' not handled",
                    parquet_thrift.ConvertedType._VALUES_TO_NAMES[ctype])  # pylint:disable=protected-access
    return data
690193
def orng_type(self, table_name, col):
        '''
        
        '''
        mysql_type = self.types[table_name][col]
        n_vals = len(self.db.col_vals[table_name][col])
        if mysql_type in OrangeConverter.continuous_types or (
                        n_vals >= 50 and mysql_type in OrangeConverter.integer_types):
            return 'c'
        elif mysql_type in OrangeConverter.ordinal_types + OrangeConverter.integer_types:
            return 'd'
        else:
            return 'string'
361798
def sum_(self, col: str) -> float:
        
        try:
            df = self.df[col]
            num = float(df.sum())
            return num
        except Exception as e:
            self.err(e, "Can not sum data on column " + str(col))