Let's say I have two data sets. I have a week-by-week tally of users who tried my service.
trials = [2,2,2,8,8,4]
And I have a week by week tally of trial users who signed up.
conversions = [1,0,2,4,8,3]
I can do it pretty quickly this way:
conversion_rate = []
for n in range(len(trials)):
conversion_rate.append(conversions[n]/trials[n])
Can you think of a more elegant way?
Bonus: The result of this is a list of ints [0, 0, 1, 0, 1, 0]
, not a list of floats. What's the easiest way to get a list of floats?