<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def expression_nf(sample_frame, nf_n, ref_sample):
 """Calculates expression of samples in a sample data frame relative to pre-computed normalization factors. ref_sample should be defined for all targets or the result will contain many NaNs. :param DataFrame sample_frame: A sample data frame. :param Series nf_n: A Series of normalization factors indexed by sample. You probably got this from `compute_nf`. :param string ref_sample: The name of the sample to normalize against, which should match a value in the sample_frame Sample column. :return: a Series of expression values for each row in the sample data frame. :rtype: Series """

    ref_sample_df = sample_frame.ix[sample_frame['Sample'] == ref_sample, ['Target', 'Cq']]
    ref_sample_cq = ref_sample_df.groupby('Target')['Cq'].aggregate(average_cq)

    delta = -sample_frame['Cq'] + asarray(ref_sample_cq.ix[sample_frame['Target']])
    rel = power(2, delta) / asarray(nf_n.ix[sample_frame['Sample']])
    return rel