import read_csv_data
import matplotlib.pyplot as plt
import numpy as np
import os

files = os.listdir("./data")
threshold = 10
all_like = np.zeros((1))
counter = 0

for file in files:
    content = read_csv_data.CsvParser(os.path.join("./data",file))
    tt = content.get_tt()
    like = np.array(tt[3],dtype=int)
    all_like = np.concatenate((all_like,like))
    for l in like:
        if l> threshold :
            counter+=1
    print(counter)

print("song nb = " + str(all_like.size))
print("for like > %d, we have %d (%f percent)" % (threshold, counter, counter/all_like.size*100))
plt.yscale('log', nonposy='clip')
plt.hist(all_like, bins=100)
plt.show()

#all song #= 549640
