# How to I get the data to get the fraction, or percent?

# It looks like I have to get data from two rows, and compare to data in one row?

# How can I do that and/or do it another way(s)?

# https://www.codecademy.com/paths/data-science/tracks/data-processing-pandas/modules/dspath-agg-pandas/projects/pandas-shoefly-ab-test

# Aggregates in Pandas

# A/B Testing for ShoeFly.com

“”"

10.

For each group (a_clicks and b_clicks), calculate the percent of users who clicked on the ad by day.

First, group by is_click and day. Next, pivot the data so that the columns are based on is_click. Finally, calculate the percent of people who clicked on the ad.

Compare the results for A and B. What happened over the course of the week?

Do you recommend that your company use Ad A or Ad B?

“”"

```
# Stuff I've tried, and doesn't work:
# "Finally, calculate the percent of people who clicked on the ad."
#a_clicks_by_day_pivot['Click_Fraction'] = a_clicks_by_day_pivot['True']/(a_clicks_by_day_pivot['True']+a_clicks_by_day_pivot['False']) # Can it be done this way? Doesn't look like it so far...
#fraction = lambda x : x['True']/(x['True']+x['False'])
#a_clicks_by_day_pivot['Click_Fraction'] = a_clicks_by_day_pivot.apply(fraction)
#print(a_clicks_by_day_pivot)
```