Exemplo n.º 1
0
def make_df_results():
    """
    Creates two dataframes, one containing all speed data and one containing all strokes data
    """
    file_name_results = '../data/Racedata/total_file_results.csv'

    time = datetime.now().strftime('%d-%m %H:%M:%S')
    print("[%s: Loading results feature file...]" % time)

    # If both total files are present no new files are created, but the df's are taken directly form the csv files
    # (Saves time)
    if os.path.isfile(file_name_results) and os.path.isfile(file_name_results):
        df_results = pd.read_csv(file_name_results, index_col=0)

    # If the file is missing, create a new one from the files in the results folders
    else:
        print('Could not find results file')
        all_results_files_dict = {}
        # loop through all available years (Hardcoded limited from 2013 to 2016) If one wants to include 2017 change 7 into 8
        for i in range(3, 7):
            path_results = '../data/Racedata/201' + str(i) + '/Results/'

            # All files are retrieved from the specified speeds folder and added to the all_speeds_files_dict
            file_retriever_results = rf.retrieve_files(path_results)
            results_files_dict = file_retriever_results.get_csv_files()
            all_results_files_dict = merge_two_dicts(all_results_files_dict, results_files_dict)

        # preproces results data to a total df
        data_preparator_results = ppr.preprocess_race(all_results_files_dict)
        df_results = data_preparator_results.read_csv_results()

    # Is returned to main
    return df_results
Exemplo n.º 2
0
def make_data_results(file_dict_results):
    """
        :param: file_dict_results
        :return: Nothing, just places parsed files in the folder Results. These folders are in each year containing
         the parsed files for that year
        """
    prep_results = ppr.preprocess_race(file_dict_results)
    prep_results.read_raw_results()
Exemplo n.º 3
0
def make_data_GPS(file_dict_GPS):
    """
    :param: file_dict_GPS
    :return: Nothing, just places parsed files in the folders Speeds and Strokes. These folders are in each year containing
     the parsed files for that year
    """
    prep_GPS = ppr.preprocess_race(file_dict_GPS)
    prep_GPS.read_raw_GPS()