Each household is flagged is_donor (gave a SUCCEEDED individual gift), is_patron (registered for a performance), and is_class_taker (registered for a class).
Code
import pandas as pd
import plotly.express as px
from hh.io import read_parquet
from hh.viz import style, CATEGORICAL
hh = read_parquet("processed" , "households_summary.parquet" )
counts = (
pd.Series(
{
"Donors" : hh["is_donor" ].sum (),
"Patrons (performances)" : hh["is_patron" ].sum (),
"Class-takers" : hh["is_class_taker" ].sum (),
"Donor and class" : (hh["is_donor" ] & hh["is_class_taker" ]).sum (),
"Donor and patron" : (hh["is_donor" ] & hh["is_patron" ]).sum (),
"All three" : (hh["is_donor" ] & hh["is_patron" ] & hh["is_class_taker" ]).sum (),
},
name= "households" ,
)
.reset_index()
.rename(columns= {"index" : "group" })
)
Code
fig = px.bar(counts, x= "group" , y= "households" , color= "group" , color_discrete_sequence= CATEGORICAL)
fig.update_layout(showlegend= False , xaxis_title= "" , yaxis_title= "Households" )
fig.update_traces(hovertemplate= "% {y:,.0f} <extra></extra>" )
style(fig).show()
Which performances the donor households actually attend is in What performances do donors attend? ; how far donors live from the hall is in Where do donors live? .