(data, prob_column=None)
return p
Checks for presence of a probability column and returns the result
    as a numpy array. If the probabilities are weights (i.e. they don't
    sum to 1), then this will be recalculated.

    Parameters
    ----------
    data: pandas.DataFrame
        Table to sample from.
    prob_column: string, optional, default None
        Name of the column in the data to provide probabilities or weights.

    Returns
    -------
    numpy.array
Checks for presence of a probability column and returns the result
    as a numpy array. If the probabilities are weights (i.e. they don't
    sum to 1), then this will be recalculated.
Checks for presence of a probability column and returns the result as a numpy array . If the probabilities are weights ( i . e . they don t sum to 1 ) then this will be recalculated .
def get_probs(data, prob_column=None):
    """
    Checks for presence of a probability column and returns the result
    as a numpy array. If the probabilities are weights (i.e. they don't
    sum to 1), then this will be recalculated.

    Parameters
    ----------
    data: pandas.DataFrame
        Table to sample from.
    prob_column: string, optional, default None
        Name of the column in the data to provide probabilities or weights.

    Returns
    -------
    numpy.array

    """
    if prob_column is None:
        p = None
    else:
        p = data[prob_column].fillna(0).values
        if p.sum() == 0:
            p = np.ones(len(p))
        if abs(p.sum() - 1.0) > 1e-8:
            p = p / (1.0 * p.sum())
    return p
def get_probs ( data , prob_column = None ) : if prob_column is None : p = None else : p = data [ prob_column ] . fillna ( 0 ) . values if p . sum ( ) == 0 : p = np . ones ( len ( p ) ) if abs ( p . sum ( ) - 1.0 ) > 1e-8 : p = p / ( 1.0 * p . sum ( ) ) return p