I have a data frame that has measurements in it and a second data frame with stats on those measurements. For example:

```
def calc_zscore(x, mean, stdev):
    return (x - mean)/stdev

metrics = ['Temperature', 'Length', 'Width']
values = ['mean', 'stdev']

data = pd.DataFrame(columns = metrics)
stats = pd.DataFrame(index = metrics, columns = values)

stats.ix['Temperature', 'mean'] = 72.1
stats.ix['Temperature', 'stdev'] = 6.3

data.loc[0, 'Temperature'] = 68.2
data.loc[1, 'Temperature'] = 76.2
data.loc[2, 'Temperature'] = 73.6

metric = 'Temperature'

for row in data.index:

    data.ix[row, metric + '_zscore'] = calc_zscore( data.ix[row, metric], stats.ix[metric, 'mean'], stats.ix[metric, 'stdev'])

print data

```

This works as I want it to, however I have to iterate over every row in the data frame. It's slow and the data frame has 300k rows. I also need to calc the z\_score for each column, however to keep it simple I'm only doing the Temperature column for this example. 

```
  Temperature Length Width  Temperature_zscore
0        68.2    NaN   NaN           -0.619048
1        76.2    NaN   NaN            0.650794
2        73.6    NaN   NaN            0.238095

```

Using the apply() method seems to be the path to pandas magic heaven, however I'm not sure how to pass the correct values to the calc\_zscore function using apply().

PS I'm not actually calculating the z-score, I'm justing using this as an example. I know I could also used mean() and std() methods however it's just an example and let's pretend they don't exist.