def get_counts(df, field, save_path=None):
    """Get the topic counts by a particular field"""
    counts_df = df[['#topic', field, 'doc']].copy()    
    counts = counts_df.groupby(['#topic', field]).count()
    counts.rename(columns={'doc': 'Number of Docs'}, inplace=True)
    counts = counts.unstack(fill_value=0)
    counts.columns = counts.columns.get_level_values(1)
    counts.columns.name = ''
    counts.index.name = ''
    if save_path is not None:
        counts.to_csv(save_path)
    return counts