ionic_liquids/utils.py
def normalization(data, means=None, stdevs=None):
    """
    Normalizes the data using the means and standard
    deviations given, calculating them otherwise.
    Returns the means and standard deviations of columns.

    Inputs
    ------
    data : Pandas DataFrame
    means : optional numpy argument of column means
    stdevs : optional numpy argument of column st. devs

    Returns
    ------
    normed : the normalized DataFrame
    means : the numpy row vector of column means
    stdevs : the numpy row vector of column st. devs

    """
    cols = data.columns
    data = data.values

    if (means is None) or (stdevs is None):
        means = np.mean(data, axis=0)
        stdevs = np.std(data, axis=0, ddof=1)
    else:
        means = np.array(means)
        stdevs = np.array(stdevs)

    # handle special case of one row
    if (len(data.shape) == 1) or (data.shape[0] == 1):
        for i in range(len(data)):
            data[i] = (data[i] - means[i]) / stdevs[i]
    else:
        for i in range(data.shape[1]):
            data[:,i] = (data[:,i] - means[i]*np.ones(data.shape[0])) / stdevs[i]

    normed = pd.DataFrame(data, columns=cols)

    return normed, means, stdevs

    Normalizes the data using the means and standard
    deviations given, calculating them otherwise.
    Returns the means and standard deviations of columns.

    Inputs
    ------
    data : Pandas DataFrame
    means : optional numpy argument of column means
    stdevs : optional numpy argument of column st. devs

    Returns
    ------
    normed : the normalized DataFrame
    means : the numpy row vector of column means
    stdevs : the numpy row vector of column st. devs

    
Normalizes the data using the means and standard
deviations given, calculating them otherwise.
Returns the means and standard deviations of columns.

Inputs

data : Pandas DataFrame
means : optional numpy argument of column means
stdevs : optional numpy argument of column st. devs

Returns

normed : the normalized DataFrame
means : the numpy row vector of column means
stdevs : the numpy row vector of column st. devs
Normalizes the data using the means and standard deviations given calculating them otherwise . Returns the means and standard deviations of columns . Inputs data : Pandas DataFrame means : optional numpy argument of column means stdevs : optional numpy argument of column st . devs Returns normed : the normalized DataFrame means : the numpy row vector of column means stdevs : the numpy row vector of column st . devs
def normalization(data, means=None, stdevs=None):
    cols = data.columns
    data = data.values
    if (means is None) or (stdevs is None):
        means = np.mean(data, axis=0)
        stdevs = np.std(data, axis=0, ddof=1)
    else:
        means = np.array(means)
        stdevs = np.array(stdevs)
    if (len(data.shape) == 1) or (data.shape[0] == 1):
        for i in range(len(data)):
            data[i] = (data[i] - means[i]) / stdevs[i]
    else:
        for i in range(data.shape[1]):
            data[:,i] = (data[:,i] - means[i]*np.ones(data.shape[0])) / stdevs[i]
    normed = pd.DataFrame(data, columns=cols)
    return normed, means, stdevs
def normalization ( data , means = None , stdevs = None ) : cols = data . columns data = data . values if ( means is None ) or ( stdevs is None ) : means = np . mean ( data , axis = 0 ) stdevs = np . std ( data , axis = 0 , ddof = 1 ) else : means = np . array ( means ) stdevs = np . array ( stdevs ) if ( len ( data . shape ) == 1 ) or ( data . shape [ 0 ] == 1 ) : for i in range ( len ( data ) ) : data [ i ] = ( data [ i ] - means [ i ] ) / stdevs [ i ] else : for i in range ( data . shape [ 1 ] ) : data [ : , i ] = ( data [ : , i ] - means [ i ] * np . ones ( data . shape [ 0 ] ) ) / stdevs [ i ] normed = pd . DataFrame ( data , columns = cols ) return normed , means , stdevs
Normalizes the data using the means and standard
deviations given, calculating them otherwise.
Normalizes the data using the means and standard deviations given calculating them otherwise .
"""
    Normalizes the data using the means and standard
    deviations given, calculating them otherwise.
    Returns the means and standard deviations of columns.

    Inputs
    ------
    data : Pandas DataFrame
    means : optional numpy argument of column means
    stdevs : optional numpy argument of column st. devs

    Returns
    ------
    normed : the normalized DataFrame
    means : the numpy row vector of column means
    stdevs : the numpy row vector of column st. devs

    """ # handle special case of one row
data
means
stdevs