def validate_sample_frame(sample_frame):
    """Makes sure that `sample_frame` has the columns we expect.

    :param DataFrame sample_frame: A sample data frame.
    :return: True (or raises an exception)
    :raises TypeError: if sample_frame is not a pandas DataFrame
    :raises ValueError: if columns are missing or the wrong type
    """
    if not isinstance(sample_frame, pd.core.frame.DataFrame):
        raise TypeError("Expected a pandas DataFrame, received {}".format(type(sample_frame)))
    for col in ['Sample', 'Target', 'Cq']:
        if col not in sample_frame:
            raise ValueError("Missing column {} in sample frame".format(col))
    if sample_frame['Cq'].dtype.kind != 'f':
        raise ValueError("Expected Cq column to have float type; has type {} instead".format(str(sample_frame['Cq'].dtype)))
    return True
def validate_sample_frame ( sample_frame ) : if not isinstance ( sample_frame , pd . core . frame . DataFrame ) : raise TypeError ( "Expected a pandas DataFrame, received {}" . format ( type ( sample_frame ) ) ) for col in [ 'Sample' , 'Target' , 'Cq' ] : if col not in sample_frame : raise ValueError ( "Missing column {} in sample frame" . format ( col ) ) if sample_frame [ 'Cq' ] . dtype . kind != 'f' : raise ValueError ( "Expected Cq column to have float type; has type {} instead" . format ( str ( sample_frame [ 'Cq' ] . dtype ) ) ) return True
Makes sure that `sample_frame` has the columns we expect.

    :param DataFrame sample_frame: A sample data frame.
    :return: True (or raises an exception)
    :raises TypeError: if sample_frame is not a pandas DataFrame
    :raises ValueError: if columns are missing or the wrong type