Eda, Exploratory Data Analysis, Pandas, Python.
= pd.DataFrame({'x': data[ivars], 'y': data[target]}) # Calculate the number of events in each group (bin) d = d0.groupby("x", as_index=False).agg({"y": ["count", "sum"]}) d.columns = ['Cutoff', 'N', 'Events'] # Calculate % of events in each group. d['% of Events'] = np.maximum(d['Events'], 0.5) /