def convert_to(data, inunit, outunit, inplace_units=False, key=None):
    """ 
    Converts data from one unit to the other 
 
    Parameters 
    ----------- 
    data: pandas.series 
        to be chanhed from one unit to the other 
    inunit: pint.quantity or dict 
        unit(s) that the data is in 
    outunit: str 
        convert to this unit 
    inplace_units: bool 
        if inunit is a dict, the dict is update in place. "key" keyword must be provided 
    key: str 
        if inunit is a dict, it is the name of the variable to be changed 
    """
    from .. import Q_
    if key:
        Q = inunit[key].to(outunit)
    else:
        Q = inunit.to(outunit)
    coef = Q.magnitude
    outunit = Q.units
    if inplace_units:
        inunit.update({key: outunit})
        return data * coef
    else:
        return data * coef, outunit
