<jupyter_start><jupyter_text>As one can see from the above 2 plots and the correlation grid below there is: -  -0.36 correlation between "Total Checkout and Registration Year" -  -0.29 correlation between "Total Renewal and Registration Year"Even though the majority of the members have relatively low library activity, when we filter out the less active members (such as members with renewal< 2000 xor checkout < 5000) the correlations get weaker. That's why we will keep all membersLet's assign a representative (numerical) age per "Age Range" and check the correlation between every parameter in our dataset<jupyter_code>dict_age = {'0 to 9 years' : 5, '10 to 19 years' : 15, '20 to 24 years' : 22, '25 to 34 years' : 30, \
            '35 to 44 years': 40, '45 to 54 years' : 50, '55 to 59 years' : 57,'60 to 64 years' : 62, '65 to 74 years' : 70,\
            '75 years and over': 80}
data["Age"] = data["Age Range"].map(dict_age)

def display_corr(values, size):
    sns.set(style="white")

    #the correlation matrix
    corr = values.corr()

    # Generate a mask for the upper triangle
    mask = np.zeros_like(corr, dtype=np.bool)
    mask[np.triu_indices_from(mask)] = True

    # Set up the matplotlib figure
    f, ax = plt.subplots(figsize=(size, size))

    # Generate a custom diverging colormap
    cmap = sns.diverging_palette(220, 10, as_cmap=True)

    # Draw the heatmap with the mask and correct aspect ratio
    sns.heatmap(corr, mask=mask, annot=True,cmap=cmap, vmax=.3,
            square=True,  ax=ax)
    ax = plt.xticks(fontsize = 12,color="steelblue", alpha=0.8, rotation=90)
    ax = plt.yticks(fontsize = 12,color="steelblue", alpha=0.8)
    
display_corr(data, 8)
sns.violinplot(y="Year Patron Registered", data=data[data["Outside of County"] == True], split = True, palette="Set3")
plt.figure(figsize=(10,8))
incidence_count_matrix_long = pd.DataFrame({'count' : data.groupby( [ "Patron Type Definition","Age"] ).size()}).reset_index()
incidence_count_matrix_pivot = incidence_count_matrix_long.pivot("Patron Type Definition","Age","count") 
ax = sns.heatmap(incidence_count_matrix_pivot, annot=True,  linewidths=1, square = False,cbar = False, cmap="Blues") 
ax = plt.xticks(fontsize = 12,color="steelblue", alpha=0.8)
ax = plt.yticks(fontsize = 12,color="steelblue", alpha=0.8)
ax = plt.xlabel("Age", fontsize = 24, color="steelblue")
ax = plt.ylabel("Type", fontsize = 24, color="steelblue")
ax = plt.title("Patron Type and Age Distributions", fontsize = 24, color="steelblue")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12735849056603774, 'fraction_numerical': 0.041666666666666664, 'mean_word_length': 4.568927789934355, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '438499', 'license': 'MIT', 'n_tokens_mistral': 940, 'n_tokens_neox': 832, 'n_words': 264, 'path': 'visualization/5.age-type-library.ipynb', 'repo_name': 'huseinzol05/Machine-Learning-Data-Science-Reuse', 'size': '2544'}