import numpy as np
import pandas as pd
df = pd.read_csv('ADR_NOV.csv', encoding='latin1', error_bad_lines=False)
df_cleaned = df[pd.to_numeric(df['INTERACTION_ID'], errors='coerce').notnull()]
desired_rt = [np.nan, 'HANDLED', 'ABANDONED']
df_cleaned = df_cleaned[df_cleaned.RECORD_TYPE.isin(desired_rt)]
df_cleaned['INTERACTION_ID_COUNT'] = 1
grouped = df_cleaned.INTERACTION_ID_COUNT.groupby(df.INTERACTION_ID)
iic_series = grouped.sum()
iic_series = iic_series[1:]
iic_series.mean()