Closed keith0811 closed 1 year ago
The Problem is, that the column 'Season' is in the form '2012/13' and not in the form '2012' in the other leagues. But you can change the procedure _download in the file database/network/footballdata/extra.py to
def _download(self, league: League) -> pd.DataFrame:
extra_df = pd.read_csv(league.url)
if '/' in str(extra_df['Season'][0]):
extra_df['Season'] = extra_df['Season'].apply(lambda x: int(x.split('/')[0]))
return extra_df
the issue with some leagues is that they have season asta yyyy/yyyy, for exemple 2012/2013, while most of them has the season as yyyy, 2012 only. Mexico, Denmark, Romania and some other leagues have yyyy/yyyy and not possible to create league. maybe someone managed to solve it...
The Problem is, that the column 'Season' is in the form '2012/13' and not in the form '2012' in the other leagues. But you can change the procedure _download in the file database/network/footballdata/extra.py to
def _download(self, league: League) -> pd.DataFrame: extra_df = pd.read_csv(league.url) if '/' in str(extra_df['Season'][0]): extra_df['Season'] = extra_df['Season'].apply(lambda x: int(x.split('/')[0])) return extra_df
Thanks. It works well.
Works great! Thanks!
Manage to create for other leagues, but facing issue for mexico one.
Exception in thread Thread-1 (_store_league): Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 982, in run self._target(*self._args, **self._kwargs) File "/Users//Documents/soccer-predict/gui/dialogs/league.py", line 115, in _store_league matches_df, league = self._league_repository.create_league( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Documents/soccer-predict/database/repositories/league.py", line 90, in create_league return self._store_league( ^^^^^^^^^^^^^^^^^^^ File "/Users//Documents/soccer-predict/database/repositories/league.py", line 56, in _store_league ).compute_statistics(statistic_columns=league_config['statistic_columns']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Documents/soccer-predict/preprocessing/statistics.py", line 51, in compute_statistics matches_df[column] = self._statistics_mapper[column]() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Documents/soccer-predict/preprocessing/statistics.py", line 57, in _compute_last_n_home_wins return self._compute_last_results(team_index=1, target_result_value='H') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Documents/soccer-predict/preprocessing/statistics.py", line 71, in _compute_last_results for season in range(self._max_season, self._min_season - 1, -1):