Seems like some kookiness involving Python2 and different behaviour when dividing two pandas.Series and when dividing two integers.
In Python2 dividing two integers with the / operator produces another integer. You can try this quickly by using the calculation for the first row if you like-
print(80 / (175 + 80))
# or get the type-
print(type(80 / (175 + 80)))
This would explain why you get 0 as the output. If you wanted it to worked then make sure to use a float somewhere. Since you say percentages (even if you don’t use them here) perhaps multiplying by the float 100.0 would work but make sure you do that before the two integers are divided (either of the two can be a float to get a float output).
The quirkiness pops up in the division of two pandas Series which seems to provide a float64 type instead, try for example-
print(clicks_pivot[True] / clicks_pivot[True])
would show an output like-
I don’t think that behaviour exists when dividing two numpy arrays (I didn’t use pandas back when I had to use Python2) so it’s quite unexpected. There may be some history in versioning here which covers it in better detail.
Pandas compared to numpy (python2 supported versions)
x = pd.Series([1, 1])
y = pd.Series([1, 1])
print(x / y)
Out: 0 1.0
dtype: float64 # floats
x = np.array([1, 1])
y = np.array([1, 1])
print(x / y)
Out: [1 1] # These are integers
print((x / y).dtype)