def preprocess_dataframe(data):
    """Helper method to preprocess the dataframe.
       Creates new columns for year,month,recalls and percentage change.
       Limits the date range for the experiment (these data are trustworthy)."""
    data['recalls'] = data['doc_count'] + 1
    data.drop(columns=['product', 'Unnamed: 0', 'key', 'key_as_string', 'doc_count'], inplace=True)
    data = data.resample("M").sum()
    mask = (data.index > '2007-05-31') & (data.index < '2019-09-30')
    data = data.loc[mask]
    data['pct'] = data['recalls'].pct_change()
    return data