<jupyter_start><jupyter_text>Analysis of <NAME> Halfmarathon 2019<jupyter_code>import os
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
import nbimporter
from src import scraper

def hour_to_decimal(hour: str) -> float:
    digits = hour.split(':')
    return int(digits[0]) + int(digits[1]) / 60.0 + int(digits[2]) / 6000.0

def histogram(columns, header, xlabel, ylabel='Frequency'):
    for column in columns:
        plt.hist(column, bins=50, rwidth=0.85, alpha=0.4)
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)
    plt.title(header)
    plt.show()


AGE_CLASSES = {
    '–': -1,
    'JU18': 0,
    'JU20': 1,
    'HK': 2,
    '30': 3,
    '35': 4,
    '40': 5,
    '45': 6,
    '50': 7,
    '55': 8,
    '60': 9,
    '65': 10,
    '70': 11,
    '75': 12,
    '80': 13,
    'M85': 14,
}
data_m = pd.read_csv(scraper.get_csv(2019, 'M'), delimiter=scraper.DELIMITER)
data_w = pd.read_csv(scraper.get_csv(2019, 'W'), delimiter=scraper.DELIMITER)
data_m_w = pd.concat([data_w, data_m])
data_m_w.head()

data_m['Finish_decimal'] = data_m['Finish'].apply(hour_to_decimal)
data_w['Finish_decimal'] = data_w['Finish'].apply(hour_to_decimal)<jupyter_output><empty_output><jupyter_text>Overview men an women<jupyter_code>histogram([data_m['Finish_decimal'], data_w['Finish_decimal']], 'Distribution of finishing times', 'hours')
main_age_class_m = data_m[data_m['AC'] == 'HK']
main_age_class_w = data_w[data_w['AC'] == 'HK']
histogram([main_age_class_m['Finish_decimal'], main_age_class_w['Finish_decimal']], 'Distribution of finishing times of main age class (HK)', 'Hours')<jupyter_output><empty_output><jupyter_text>Top clubs by number<jupyter_code>data_m_w['Club'].value_counts().head(20)<jupyter_output><empty_output><jupyter_text>Detail analysis men  Top and worst placements<jupyter_code>data_m.head()
data_m.tail()<jupyter_output><empty_output><jupyter_text>Average finish times<jupyter_code>data_m.groupby('AC').mean()<jupyter_output><empty_output><jupyter_text>Number of people in age class<jupyter_code>data_m['AC'].value_counts().plot.bar()<jupyter_output><empty_output><jupyter_text>Distribution of finishing times in age classes<jupyter_code># add map age classes to integers
data_m['AC_label'] = data_m['AC']
data_m['AC_label'] = data_m.AC.replace(AGE_CLASSES)

data_m.boxplot(by='AC_label', column='Finish_decimal')
plt.xticks(range(1, len(AGE_CLASSES) + 1), list(AGE_CLASSES.keys()))
plt.show()<jupyter_output><empty_output><jupyter_text>Correlation of numeric colums<jupyter_code>data_m.corr()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1590380139643134, 'fraction_numerical': 0.0321955003878976, 'mean_word_length': 6.54093567251462, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 35, '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': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '658051', 'license': 'MIT', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1023, 'n_words': 172, 'path': 'analysis.ipynb', 'repo_name': 'campfireman/haj-analysis', 'size': '2584'}