Nov-11-2018, 03:13 PM
Hi there,
I'm new to Python, have previously done a little C but nothing to deep. I want to build a program to sort out soccer results from a CSV file and thought it would be good to get som pointers from more experienced coders to have a proper set-up.
So far i have read the csv-file and divided it to a 2D array. In total it's around 1700 rows, the first ones looks like this:
[['Country', 'League', 'Season', 'Date', 'Time', 'Home', 'Away', 'HG', 'AG', 'Res', 'PH', 'PD', 'PA', 'MaxH', 'MaxD', 'MaxA', 'AvgH', 'AvgD', 'AvgA']. ['Sweden', 'Allsvenskan', '2012', '12-03-31', '15:00', 'Elfsborg', 'Djurgarden', '2', '1', 'H', '1,71', '3,98', '5,44', '1,73', '3,98', '5,5', '1,66', '3,68', '5'], ['Sweden', 'Allsvenskan', '2012', '12-03-31', '15:00', 'GAIS', 'Hacken', '0', '0', 'D', '2,21', '3,57', '3,48', '2,5', '3,57', '3,5', '2,25', '3,24', '3,11'] --- and so on....
I want to make a program that lets me choose a team and a number of games. Then i get the stats for that number of games for that team. For example "Team A" + "4 games", gives me the data for the latest 4 games for "Team A". Later in the program i want to work with the chosen stats and calculate form for chosen team and predictions for upcoming games.
So.. sorry for long introduction... my question is, what's the best way to set this up? I've been thinking of using dictionary for each game, or is it better to use classes for every team? Or maybe I don't need any of that. Perhaps it's easier to just sort the list after teams and dates of games and then just chose the number of games to look at?
Hope to get some good input here before i just spending hours on a dead-end solution.
Thanks in advance
I'm new to Python, have previously done a little C but nothing to deep. I want to build a program to sort out soccer results from a CSV file and thought it would be good to get som pointers from more experienced coders to have a proper set-up.
So far i have read the csv-file and divided it to a 2D array. In total it's around 1700 rows, the first ones looks like this:
[['Country', 'League', 'Season', 'Date', 'Time', 'Home', 'Away', 'HG', 'AG', 'Res', 'PH', 'PD', 'PA', 'MaxH', 'MaxD', 'MaxA', 'AvgH', 'AvgD', 'AvgA']. ['Sweden', 'Allsvenskan', '2012', '12-03-31', '15:00', 'Elfsborg', 'Djurgarden', '2', '1', 'H', '1,71', '3,98', '5,44', '1,73', '3,98', '5,5', '1,66', '3,68', '5'], ['Sweden', 'Allsvenskan', '2012', '12-03-31', '15:00', 'GAIS', 'Hacken', '0', '0', 'D', '2,21', '3,57', '3,48', '2,5', '3,57', '3,5', '2,25', '3,24', '3,11'] --- and so on....
I want to make a program that lets me choose a team and a number of games. Then i get the stats for that number of games for that team. For example "Team A" + "4 games", gives me the data for the latest 4 games for "Team A". Later in the program i want to work with the chosen stats and calculate form for chosen team and predictions for upcoming games.
So.. sorry for long introduction... my question is, what's the best way to set this up? I've been thinking of using dictionary for each game, or is it better to use classes for every team? Or maybe I don't need any of that. Perhaps it's easier to just sort the list after teams and dates of games and then just chose the number of games to look at?
Hope to get some good input here before i just spending hours on a dead-end solution.
Thanks in advance
