<jupyter_start><jupyter_text>PurposeThe purpose of this notebook is to look into the basic information of the Spotify dataset Load Libraries<jupyter_code>import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import swifter
import os<jupyter_output><empty_output><jupyter_text>Prepping Data<jupyter_code>data = pd.read_parquet('../data/KidListeningEventsWithAudioFeatures.gzip.parquet')
data.drop(columns = ['Artist Id', 'Album Id', 'Track Id', 'Event Unixtime', 'Artist', 'Album', 'Track'], inplace = True)
data = data[data['Mode'].isna() == False]
data
meanPerUser = data.groupby(['Education Level', 'User Id'], observed = True).agg('mean').reset_index()
meanPerUser<jupyter_output><empty_output><jupyter_text>Basic Information<jupyter_code>print('Number of Listening Events with Audio Features: ' + str(len(data)))
data.describe()
print('Number of Users with Audio Features: ' + str(len(meanPerUser)))
meanPerUser.describe()
for dataset in [data, meanPerUser]:
    corr = dataset.corr()
    vmax = np.abs(corr.values).max()
    mask = np.zeros_like(corr)
    mask[np.triu_indices_from(mask)] = True
    fig = plt.figure()
    fig.set_size_inches(w=15,h=6)
    sns.heatmap(corr, cmap = plt.cm.PuOr, vmin = -vmax, vmax = vmax, annot=True, mask=mask);
for column in data.columns:
    if (column == 'User Id'):
        continue

    fig, axs = plt.subplots(ncols=2, figsize=(15, 5));
    ax = sns.histplot(data = data[column], kde = False, ax = axs[0])
    ax.set(title = 'Per Listening Event')

    ax = sns.histplot(data = meanPerUser[column], kde = False, ax = axs[1])
    ax.set(title = 'Per User')
    
    plt.show();<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14319526627218934, 'fraction_numerical': 0.0053254437869822485, 'mean_word_length': 5.060931899641577, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '547742', 'license': 'MIT', 'n_tokens_mistral': 613, 'n_tokens_neox': 590, 'n_words': 143, 'path': 'analysis/Spotify Basic Analysis.ipynb', 'repo_name': 'PIReTship/kMusic-LBR21', 'size': '1690'}