freq / k this will return plain ZERO
If it is less than one then it is being rounded to zero because divide defaults to integers in Python 2.X, so convert to float
float(freq) / k
and see if that makes a difference. If not, post some test data as well.