Last 5 matches between teams added to data_filters, fix shots fuzzy rules

This commit is contained in:
s487194 2024-01-23 23:26:53 +01:00
parent 651b3562da
commit 089139b660
2 changed files with 11 additions and 5 deletions

View File

@ -29,6 +29,13 @@ def last5Matches(season, teamA, data, df):
return last_before_date
def last5MatchesBtwTeams(teamA, teamB, data, df):
subset = df[(((df['home_team'] == teamA) | (df['away_team'] == teamA)) & ((df['home_team'] == teamB) | (df['away_team'] == teamB)))]
before_given_date = subset[pd.to_datetime(subset['date']) < pd.to_datetime(data)]
before_given_date = before_given_date.sort_values(by='date', ascending=False)
last_before_date = before_given_date.head(5)
return last_before_date
def seasonMatches(season, teamA, data, df):
# Wybierz rekordy dla danej pary drużyn i sezonu

View File

@ -104,14 +104,13 @@ def categorize_fuzzy_shots(shots_overall, shots_on_target):
"IF (shots_overall IS high ) AND (shots_on_target IS low) THEN (quality_of_shots IS low)",
"IF (shots_overall IS average) AND (possession IS high) THEN (quality_of_shots IS high)",
"IF (shots_overall IS average) AND (shots_on_target IS high) THEN (quality_of_shots IS high)",
"IF (passes IS high) AND (possession IS average) THEN (quality_of_shots IS high)",
"IF (shots_overall IS high) AND (shots_on_target IS average) THEN (quality_of_shots IS average)",
"IF (passes IS low) AND (possession IS average) THEN (quality_of_shots IS low)",
"IF (passes IS average) AND (possession IS low) THEN (quality_of_shots IS average)"
"IF (shots_overall IS low) AND (shots_on_target IS average) THEN (quality_of_shots IS average)",
"IF (shots_overall IS average) AND (shots_on_target IS low) THEN (quality_of_shots IS low)"
])