So I'm doing a use case for a company interview and one of the questions is to calculate the CTR for a sorting algorithm.
My question would be: Should I remove the operations where there were no products shown (even though some of them there were clicks on products)?Example (should discard this columns?):
Number of impressions | Number of clicks 0 | 1 0 | 3 0 | 0
CTR = #products clicked/#products shown
My other doubt is wether should I sum the clicks and the products shown and then divide one on other OR should I do the CTR for each operation:
Pseudo Python code (imagine that I have a dataframe with several operations as rows):
CTR = pd_df["no_clicks"].sum() / pd_df["no_impressions"].sum()
pd_df["CTR"] = pd_df["no_clicks"] / pd_df["no_impressions"] CTR = pd_df["CTR"].mean()