Merge pull request 'Last 5 matches between teams added to data_filters, fix fuzzy rules for shots' (#1) from new-func into master

Reviewed-on: s452662/SystemyRozmyte#1
This commit is contained in:
Michał Dudziak 2024-01-24 15:03:28 +01:00
commit b08376207c
2 changed files with 11 additions and 4 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,13 +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 (shots_overall IS low) AND (shots_on_target IS average) THEN (quality_of_shots IS average)",
"IF (passes IS average) AND (possession IS low) THEN (quality_of_shots IS average)"
"IF (shots_overall IS average) AND (shots_on_target IS low) THEN (quality_of_shots IS low)"
])