I want to transform all rows of a data frame to arrays and use the arrays in a function. The function should create a new column with the results of the function for every row.
def harmonicMean(arr):
sum = 0;
for item in arr:
sum = sum + float(1.0/item);
print "inside" + str(float(1.0/item));
print sum;
return float(len(arr) / sum);
The function actually generates harmonic mean for every row in the data frame. These values should be populated in a new column in the data frame. (the data frame also contains Nan
values)