import pandas as pd
import numpy as np
df={'week':["Monday","Tuesday", "Monday", "Monday", "Tuesday"], 'Visits':[True, False, True, True, True]}
I would like to make a function wich counts all the "True" Visits and "False Visits" for all the days of the column "week" and transform it in a percentage. Here is the result expected:
I have tried :
u = np.unique(df.week)
j = len(u)
for j in df.week = u[0]:
x=(df['Visits']==True).value_counts()
print(x)
But that does not work unfortunatelly. Thank you very much for you time and help.