# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
import random

import pandas as pd
import numpy as np
from scipy import stats

# +
data = pd.read_csv("../data/csv/achmusik.csv")

data = data[data.columns[:-2]]
# Getting the decimals right -- commas to points and no more Nones
data = data.set_index(["genre", "sub_genre", "artist", "album", "song"])
data.fillna(value="", inplace=True)

for i in range(data.columns.size):
    data[data.columns[i]] = pd.to_numeric(data[data.columns[i]], errors='coerce')

data

# +
qu_df = pd.DataFrame(columns=["mean", "ok"])
qu_df["ok"] = data["Qu"].dropna().groupby("artist").size() > 4
qu_df["mean"] = data["Qu"].dropna().groupby("artist").mean()

qu_df = qu_df[qu_df["ok"] == True].sort_values(by="mean", ascending=False)
qu_df
# -

data.merge(data["Qu"].groupby("artist").size() > 5, on="artist")
# data[]["Qu"].groupby("artist").mean()



StarcoderdataJupyterScriptsDedupFiltered