Thomas Eapen · Selected work

Interaction counts & means

Define the qualifying records, count within each interaction, then make the denominator explicit.

Synthetic example · independently invented dataOne-page print edition · A3 landscape
01 Inspect the inputs02 Apply the method03 Check the result

INVENTED INPUTS

Mixed outcomes in one log

Eight independently invented event records
CaseOutcome
Case AComplete
Case AUnspecified
Case AInternal
Case BComplete
Case BComplete
Case CExit
MissingComplete
Case DInternal

Complete, Exit and unspecified outcomes qualify when a case key is present. Internal rows and missing case keys are excluded.

SELECTED PYTHON

The working calculation

Pandas is pd. rows is the log; accepted contains Complete and Exit. Unspecified outcomes are intentionally included.

events = pd.DataFrame(rows)
eligible = events.loc[
    events['case'].notna()
    & (events['outcome'].isin(accepted)
       | events['outcome'].isna())
]
counts = eligible.groupby('case').size()
mean_count = counts.mean()

The code shown here is executed to calculate this example’s results.

COMPUTED RESULT

A mean with a stated population

1.67records per qualifying interaction5 records ÷ 3 interactions
Qualifying record counts by interactionCase A: 2; Case B: 2; Case C: 1.Case A2Case B2Case C1

5 ÷ 3 = 1.67

3 rows are excluded. Case D has no qualifying records and is not part of the mean’s denominator.

What this demonstratesFiltering changes the population being described. Counting first makes both the numerator and denominator visible before calculating an average.

Check the boundaryThis is the mean among interactions with qualifying records, not among every case in the original log. An all-case average would require an explicit zero-count policy.